$(function(){
reachBottom(); //防止页面内容很短的情况
});
$(window).scroll(function(){
reachBottom();
});
function isBottom() {
var scrollTop = $(this).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(this).height();
if(scrollTop + windowHeight == scrollHeight){
return true;
}
return false;
}
var ISBOTTOM = false;
function reachBottom() {
var bottom = isBottom();
console.log(bottom);
if(bottom){
ISBOTTOM = true;
$("#footer_touch").animate({bottom:0},200);
}
if(ISBOTTOM && !bottom){
ISBOTTOM = false;
$("#footer_touch").animate({bottom:"-100px"},200);
}
}
JQUERY 判断是否到达浏览器底部
最新推荐文章于 2021-02-27 03:38:50 发布