简单的JQUERY实现类似蘑菇街、美丽说滚屏翻页

$(function(){
$(window).scroll(function(){
//var bodyTop = document.documentElement.scrollTop + document.body.scrollTop;
var bodyTop = $(document).scrollTop();
//当滚动条滚到一定距离时,执行代码
if(bodyTop>10){
//alert(bodyTop);
}
//===============================================
//滚动距离底部(200px)时出发函数
var height=parseInt($(document.body).height());
var height=parseInt(height)-200;
//滚动的当前位置+窗口的高度 >= 整个body的高度
if(bodyTop+$(window).height() >= height){
//alert(‘滚动条到底了’);
}
});
});


你可能感兴趣的:(jquery,function)