我已经用这种方式编辑了Sticky Footer script:
<script type="text/javascript">
function stickyFooter(){
jQuery("#stickyFooter").css({position: "absolute",top:($(window).scrollTop()+$(window).height()-$("#stickyFooter").height())+"px"});
}
function myStickyFooter(){
jQuery("#stickyFooter").css({position: "absolute"});
jQuery("#stickyFooter").animate({
top:($(window).scrollTop()+$(window).height()-$("#stickyFooter").height())+"px"
}, 2000, function() {
});
}
jQuery(function(){
myStickyFooter();
jQuery(window)
.scroll(stickyFooter)
.resize(stickyFooter);
});
</script>
所以,在Firefox上它运行正常;在Chrome或Ie上,它可以工作..相反:stickyFooter从上到下出现。为什么? 非常感谢!
答案 0 :(得分:2)
适用于所有浏览器。
解决方案:
您需要投入额外的工作来将粘性页脚的初始位置设置为window.height()
,然后将其设置为window.height()-($('#footer').height())