当滚动条变得可见时,正确地切换页面内容? [英] Shifting page content right when scroll bar becomes visible?

查看:83
本文介绍了当滚动条变得可见时,正确地切换页面内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当滚动条变为可见时,是否有可能使用jQuery将页面的内容(比如 10px )移动到右侧。它不能自动显示的原因是因为我的内容通过jQuery进行扩展,当它到达高度超过浏览器的点时,会显示滚动条,导致所有页面内容向右移动 10px 左右。

Is it possible using jQuery to shift the content of a page say 10px to the right when the scroll-bar becomes visible. The reason it isn't automatically visible is because my content expands via jQuery, and when it reaches the point at which it's height exceeds the browsers, the scroll-bar is displayed, causing all page content to shift to the right about 10px or so.

我希望它不会发生,并且内容保持在同一位置,而滚动条是可见的。

I'd like it so that this doesn't happen, and the content stays in the same position, while the scroll-bar is visible.

我不确定CSS属性如 body {scroll-bar:x; } (我假设 scroll-bar 是滚动条的正确属性)可以用作jQuery选择器,并且即使所以,这是如何工作的?

I'm not sure if CSS properties such as body { scroll-bar: x; } (I'm assuming that scroll-bar is the correct property for the scroll-bar) can be used as jQuery selectors, and even if so, how this would work?

任何帮助,答案,对其他文章的引用在这里完成将是很好的:)!

Any help, answers, references to other articles where this is done would be great :)!

推荐答案

您可以使用CSS来强制滚动条始终可见:

You could use CSS to force the scrollbar to always be visible:

body { overflow-y: scroll; }

这篇关于当滚动条变得可见时,正确地切换页面内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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