我正在使用此脚本,以便在滚动时会出现某些DIV,但使用移动设备时效果不佳。例如,当使用iPad时,如果我没有从屏幕上抬起手指或直到页面停止滚动,则DIV永远不会显示出来。jQuery - 如果浏览器宽度大于960,则启动脚本px
这是我有:
$(document).ready(function()
{
$(window).scroll(function(){
$('.hidden').each(function(i){
var bottom_of_object = $(this).position().top + $(this).outerHeight()/4;
var bottom_of_window = $(window).scrollTop() + $(window).height();
if(bottom_of_window > bottom_of_object){
$(this).animate({'opacity':'1'},500);
}
});
});
});
现在我只想这个脚本来启动,如果浏览器窗口比960大,以便它不会在移动设备上运行。
谢谢。