以下代码使页面向下滚动到页面底部。在这种情况下如何防止页面滚动?
// If note is clicked, then append id as hashtag at end of url
$("span.note").click(function(e){
e.preventDefault();
window.location.hash = $(this).attr('id');
});
最佳答案
此外,您可以尝试添加:e.stopPropagation();
关于javascript - 当散列更改时防止页面滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10334618/