Chrome 会记住滚动位置 [英] Chrome remembers scroll position

查看:22
本文介绍了Chrome 会记住滚动位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个实际上是 Chrome 上的功能"的问题.大多数人可能都知道,Chrome 会在您返回页面时记住它返回的滚动位置.我对此有点问题.

I'm running into a problem that's actually a "feature" on Chrome. As most of you might know, Chrome remembers a scroll position that it returns to, whenever you come back to a page. And I kind of have a problem with that.

有没有办法在用户不注意的情况下覆盖它?

Is there any way to override this without the user noticing?

米斯

失败的尝试:

  • 在 document.ready 上滚动顶部

推荐答案

我检查了 chrome,它运行良好.有时 setTimeout 确实有技巧 :)

I've checked on chrome, it worked well. Sometimes setTimeout does trick :)

<script type="text/javascript">
window.onload=function(){
    setTimeout(function(){
        scrollTo(0,-1);
    },0);
}
</script>

这篇关于Chrome 会记住滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆