jQuery实现页面下拉出现悬浮窗口的方法

$(function(){
$(window).scroll(function() {
if($(window).scrollTop() >= 450){ //向下滚动像素大于这个值时,即出现浮窗~
$('#catalog').fadeIn(300); //浮窗淡入的时间,越小出现的越快~
}else{
$('#catalog').fadeOut(300); //浮窗淡出的时间,越小消失的越快~
}
});
$('.actGotop').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);}); //浮窗动画停留时间,越小消失的越快~
});

 

posted @ 2021-08-13 16:38  吃惊夜夜  阅读(326)  评论(0编辑  收藏  举报