始终显示浏览器滚动条以防止页面跳转 [英] Always show browser scrollbar to prevent page jumping

查看:24
本文介绍了始终显示浏览器滚动条以防止页面跳转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
如何使用javascript在浏览器中始终显示滚动条?

有些页面我有很多内容,其他页面只有几行,所以当我在页面之间单击时,有些页面在浏览器上有滚动条,而其他页面没有.因此,由于在页面之间单击时有额外的空间,页面一直在跳转.

Some pages I have have lots of content other pages have a few lines, so when I am clicking between pages some pages have a scrollbar on the browsers and others don't. Because of this the page jumps all the time due to the extra space when clicking between pages.

是否有可能让滚动条一直可见,或者如果内容不多就不能停止跳转页面就变灰?

Is it possible to have the scrollbar visible at all times, or greyed out if there is not a lot of content to stop the jumping of pages?

是否可以在所有浏览器上运行,希望有人能帮忙,

Can it work across all browsers, hope someone can help,

干杯

推荐答案

尝试阅读这篇文章 by Chris Coyer,它解释得很好.

Try reading this article by Chris Coyer, it explains it pretty well.

来自文章:

将溢出-y 分配给滚动确实有效,并且在 Firefox 中也有效,Safari 和 IE 6,这使其成为最佳解决方案:

Assigning overflow-y to scroll does work, and it works in Firefox, Safari, and IE 6, and that makes it the best solution:

html {
    overflow-y: scroll; 
}

这篇关于始终显示浏览器滚动条以防止页面跳转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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