焦点のうち入力した後、iPhone(IOS)の問題解決、ページが回復しません

VAR winHeight = $(ウィンドウ).height();
VAR U = navigator.userAgent、アプリ=はnavigator.appVersion
VAR isIOS = !! u.match(/ \(I [^;] +;(U;?。)CPU +のMac OS X /); // IOS终端
VAR adOrIosTime = 0;
。$( "入力")ぼかし(関数(){
  てclearTimeout(adOrIosTime);
  IF(isIOS){
    adOrIosTime =のsetTimeout(()=> {
    (document.activeElement.tagName == 'INPUT'もし|| document.activeElement.tagName == 'TEXTAREA'){
      リターン;
    }
    = 'PC'の結果をみましょう。
    (/(iPhone |アプリ| iPodの| iOS版)の場合/i.test(navigator.userAgent)){//判断iPhone |アプリ| iPodの|のiOS
      結果= 'IOS';
    }もしそうでない(/(アンドロイド)/i.test(navigator.userAgent)){//判断Androidの
      結果= 'アンドロイド'

    IF(結果= 'IOS'){
      document.activeElement.scrollIntoViewIfNeeded(TRUE)。
    }
    }、100)
  }他{
    adOrIosTime =のsetTimeout(()=> {
      window.scrollToは(0、Math.max(winHeight - 1、0));
    }、100)。
  }
})。

注意:************************時々失敗したイベントをバインド**************** *あなたが書くことができます**************************

 <input type = 'テキスト' のonblur = "inputBlur();" />

ます。<script type = "text / javascriptの">

VAR winHeight = $(ウィンドウ).height(); 
VAR U = navigator.userAgent、アプリ=はnavigator.appVersion
VAR isIOS = !! u.match(/ \(I [^;] +;(U;?。)CPU +のMac OS X /); // IOS终端
VAR adOrIosTime = 0;
関数inputBlur(){
  てclearTimeout(adOrIosTime);
  IF(isIOS){
    adOrIosTime =のsetTimeout(()=> {
    IF(document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == ' TEXTAREA '){
      リターン;
    }
    結果を聞かせ= 'PC';
    場合(/(iPhone |アプリ| iPodの| iOS版)/i.test(navigator.userAgent)){//判断iPhone | iPadの| iPodは| iOSのは
      =結果' IOS';
    }もしそうでなければ(/(アンドロイド)/i.test(navigator.userAgent)){//判断アンドロイド
      結果= 'アンドロイド'
    }
    IF(結果= 'IOS'){
      document.activeElement.scrollIntoViewIfNeeded(TRUE)。
    }
    }、100)
  }他{
    adOrIosTime =のsetTimeout(()=> {
      window.scrollToは(0、Math.max(winHeight - 1、0));
    }、100)。
  }
}

</ SCRIPT>

おすすめ

転載: www.cnblogs.com/helloearth/p/11422751.html