【问题标题】:Using jquery to set a content area to height of page with sticky footer使用 jquery 将内容区域设置为带有粘性页脚的页面高度
【发布时间】:2013-01-29 14:00:59
【问题描述】:

http://www.playerspace.com/index.cfm/action/aboutus

我正在使用 jquery 设置一个粘性页脚,其中内容不延伸到折叠下方。

如果我没有的话,浏览器窗口底部的页脚下会有空间。

不幸的是,在发生这种情况的页面上,例如上面包含的链接,内容区域在容器底部和粘性页脚之间存在间隙。

谁能告诉我如何设置白色内容容器的高度以在页面加载时使用 jquery 来满足页脚?

【问题讨论】:

    标签: jquery html height footer


    【解决方案1】:

    你可以在没有 jQuery 的情况下做到这一点。

    设置您希望填充整个页面的容器height: 100% 以及所有父容器,包括bodyhtml

    来源:http://css-tricks.com/snippets/css/sticky-footer/

    【讨论】:

    • 我已将其设置为 100%。没有效果。
    • 将容器的每个父级设置为 100%
    • nm 我明白了: if($('#home_page_footer').length >0 ){ var footer = $("#home_page_footer"); var pos = 页脚.position(); var height = $(window).height();高度 = 高度 - pos.top;高度 = 高度 - footer.height(); if (height 0) { $("#content").height($(window).height()-258); } }
    猜你喜欢
    • 2014-02-13
    • 1970-01-01
    • 2015-05-12
    • 2015-01-18
    • 2014-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多