我有一个具有以下样式规则的页脚:
#footer
{
position: fixed;
bottom: 0px;
width: 100%;
min-width:1300px;
z-index: 3;
}我使用以下JQuery代码使滚动仅适用于x轴:
$('html, body').css({
'overflow-y': 'hidden',
'height': '100%'});当窗口小于1300px,滚动条出现时,我如何让它左右滚动?
发布于 2013-07-02 00:45:08
我做了我的评论作为回答,使用位置绝对因为位置固定不能滚动(因为元素是固定的…)
顺便说一句,当您为body设置overflow-y: hidden时,绝对位置没有理由具有与使用位置固定时不同的行为。
#footer {
position: absolute;
bottom: 0px;
width: 100%;
min-width:1300px;
z-index: 3;
background: red;
height:60px;
left:0;
}发布于 2013-07-02 00:35:09
这样如何:
$(window).scroll(function(){
$('#footer').css('left',-$(window).scrollLeft());
});你还需要这个(可能):
html, body {
min-width: 1300px;
}这是你能从固定脚注中得到的最好的结果
https://stackoverflow.com/questions/17408830
复制相似问题