问题

我建立一个网站,我发布在DIV ...当我刷新页面..如果页面滚动到位置X ...页面刷新后,当页面加载时,将在同一个滚动到位置X ...我想强制页面滚动到页面刷新... ...

  • what i can think of is of some JS / jQuery run as onLoad() function of page to SET the pages scroll to top... but i do not know the code for it...

  • a better option would be if there is some property etc to have the page loaded with its scroll position as default\top... which will be kind of like Page Load not Page Refresh



解决方法

您可以使用 scrollTop 方法在 DOM ready :

$(document).ready(function(){
    $(this).scrollTop(0);
});



相关问题推荐