AJAX 请求后停止滚动到顶部 [英] stop scrolling to top after AJAX request
本文介绍了AJAX 请求后停止滚动到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
如何在单击触发 javascript 的链接时阻止网页滚动到顶部?
我的浏览器在ajax请求后滚动到顶部然后我使用
my browser scrolls to top after ajax request then i use
$('html, body').animate({ scrollTop: $('#loadMore').offset().top }, 2000);
滚动回我的 div.有没有办法阻止它从头开始滚动到顶部
to scroll back to my div. is there a way i stop it from scrolling to top from the beginning
推荐答案
你应该在你的ajax调用函数的末尾添加return false
.或者到您的内联通话结束:
you should add return false
to the end of your ajax call function. Or to the end of your inline call:
<a href="#" onclick="someAjaxCall(); return false">Link</a>
这篇关于AJAX 请求后停止滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文