标签:
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);
标签:
原文地址:http://www.cnblogs.com/TLightSky/p/4426294.html