cat*_*use 3 javascript css jquery overflow
I did something like this to initially hide the body scrollbar, and then show it when a link is clicked:
$('body').css('overflow', 'hidden');
$('#site').click(function(e) {
$('#wrapper').remove();
$('body').css('overflow', 'scroll');
return false;
});
Run Code Online (Sandbox Code Playgroud)
At first, it does hide the scrollbar and just shows a scrollbar for the overlay (absolutely positioned div (#wrapper)) but when I click on the link (#site) to show the scrollbar again (and remove the overlay), it now shows two scrollbars: one is working, the other is disabled.
<div id="wrapper">
--- some content ----
<a href="" id="site"></a>
</div>
<div>
--- rest of the website ---
</div>
Run Code Online (Sandbox Code Playgroud)
#wrapper {
background-color: #CCC;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 99999;
height: 800px;
}
Run Code Online (Sandbox Code Playgroud)
What has gone wrong?
您也可以使用它,以防主题或样式中的某些内容导致第二个栏
html {
overflow-x: initial !important;
}
Run Code Online (Sandbox Code Playgroud)
就我而言,我试过
$('html').css('overflow', 'hidden');
Run Code Online (Sandbox Code Playgroud)
这是删除两个侧边栏,但我无法向下滚动到页脚。
我用了:
$('html').css('overflow-x', 'initial');
Run Code Online (Sandbox Code Playgroud)
完美运行,仅垂直显示一个滚动条,并且可以滚动到底部的所有内容
| 归档时间: |
|
| 查看次数: |
23351 次 |
| 最近记录: |