jquery - 具有最小宽度的固定页脚,需要能够滚动

标签 jquery css

我有一个具有以下样式规则的页脚:

#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 时,绝对位置没有理由与使用固定位置有不同的行为。

DEMO

#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/

相关文章:

javascript - Div 旋转在 JSFiddle 中有效,但在实际元素中无效

javascript - 如何从 import.io API 获取数据?

php - 当点击一个链接到一个新的 .php 页面时,该链接不起作用

css - 如何使中间列 div 始终扩展以适合?

javascript - ng-repeat 元素没有显示

javascript - "Resource interpreted as script but transferred with MIME type application/json"使用 Youtube 的 JavaScript API

css - 滚动条没有出现在 FF 中,而是出现在 Chrome 中

css - 浏览器无法识别 FontAwesome 的图标

jquery - IE 提交表单两次

html - 如何使用CSS将div移动到其他div的中心?