![](/img/trans.png)
[英]scroll top when clicking on a div, then scroll bottom if scroll is on top
[英]scroll to bottom works when i scroll to top
当滚动到页面底部时,我使用下面的代码来警告消息。 当我滚动到页面顶部时,它会发出警报。
什么地方出了错?
$(window).scroll(function(){
if($(window).scrollTop() == $(document).height()-$(window).height()){
alert("BOTTOM");
}
});
尝试
$("html, body").animate({ scrollTop: $(document).height() }, 1000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.