屏幕不够一屏的时候,底部固定在最下面,大于一屏取消固定

发布于:2017-09-08 17:36:59

function positionFooter() {
            var footer = $("#fd");
            if ((($(document.body).height() + footer.outerHeight()) < $(window).height() && footer.css("position") == "fixed") || ($(document.body).height() < $(window).height() && footer.css("position") != "fixed")) {
                footer.css({
                    position: "fixed",
                    bottom: "0",
                    width: '100%'
                });
            } else {
                footer.css({
                    position: "static"
                });
            }
        }
        function stickFooter(){
            $(window).scroll(positionFooter).load(positionFooter).resize(positionFooter);
        }
        stickFooter();


觉得有用请点个赞吧!
0 383