我有一个具有以下样式规则的页脚:
#footer
{
position: fixed;
bottom: 0px;
width: 100%;
min-width:1300px;
z-index: 3;
}
我有这个 JQuery 代码使滚动只对 x 轴可用:
$('html, body').css({
'overflow-y': 'hidden',
'height': '100%'});
当窗口小于1300px时,出现滚动条,如何左右滚动?
最佳答案
我把我的评论作为答案,使用绝对位置作为固定位置不能滚动(因为元素是固定的......)
顺便说一句,当您为正文设置 overflow-y: hidden
时,绝对位置没有理由与使用固定位置有不同的行为。
#footer {
position: absolute;
bottom: 0px;
width: 100%;
min-width:1300px;
z-index: 3;
background: red;
height:60px;
left:0;
}
关于jquery - 具有最小宽度的固定页脚,需要能够滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17408830/