window.deviceId = '{{$deviceId}}';
    window.iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false;
    if( iOS ){
      iOSversion = ( !!window.history && !!window.history.pushState ? '4+' : '4-' );
      if( !!window.matchMedia ){ iOSversion = '5+'; }
    }
    window.getViewport = function() {    // Note viewport sizing broken in Android 2.x see http://stackoverflow.com/questions/6601881/problem-with-meta-viewport-and-android
      var viewport = {
              left: window.pageXOffset,   // http://www.quirksmode.org/mobile/tableViewport.html
              top: window.pageYOffset,
              width: window.innerWidth || documentElement.clientWidth,
              height: window.innerHeight || documentElement.clientHeight
      };
      return viewport;
    }

 

在android机器上可以正常提升上来,但是在iOS机器上会出现问题。

在iOS机器上,不通过bottom来始终居底部,而是通过计算top的位置再通过scrollTo来调整位置。

 

    window.timeDelay = 300;
    setInterval(function () {
      window.scrollTo(0, 0);
    }, timeDelay);

  

相关文章:

  • 2021-05-21
  • 2021-08-15
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-09-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-06-17
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案