首页 > 其他 > 详细

滑动窗口滚动条触发事件

时间:2017-01-16 14:16:07      阅读:337      评论:0      收藏:0      [点我收藏+]

$(window).on("scroll", function() {
if (timer) {
clearTimeout(timer);
timer = null;
}

timer = setTimeout(function() {
var st = $(window).scrollTop();
$("#imgbox").css(‘top‘,st+"px"); //弹出窗
if(st>240){
$(".infoimg").each(function(i){var src =$(this).attr("_src"); $(this).attr(‘src‘,src); $(this).removeAttr("_src");});
}

var offsetTop = st - scrollTop;
if (offsetTop > 0 && st > topBarHeight) {
topBar.css("top", -topBarHeight);
} else {
topBar.css("top", 0);
}

scrollTop = st;

timer = null;
}, 300);

});

 

滑动窗口滚动条触发事件

原文:http://www.cnblogs.com/linjinzhuang/p/6289278.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!