无论如何,我有一个 JQuery 脚本来让我的页脚始终位于浏览器的底部。
问题是它使用“动画”来强制它向下或向上移动,这会在每次页面加载时显示一个从顶部滚动到底部的页脚。就像一个飞行的页脚栏。
我想知道“Animate”是否有替代方案来强制它显示在底部,现在显示它向下拖动的滚动效果?
这里的代码片段,我相信“.animate”是我需要的替代方案。
 $(window).bind("load", function() { 
   var footerHeight = 0,
       footerTop = 0,
       $footer = $("#Footer");
   positionFooter();
   function positionFooter() {
            footerHeight = $footer.height();
            footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px";
           if ( ($(document.body).height()+footerHeight) < $(window).height() + 150) {
               $footer.css({
                    position: "absolute"
               }).stop().animate({
                    top: footerTop
               })
           } else {
               $footer.css({
                    position: "static"
               })
           }
   }
   $(window)
           .scroll(positionFooter)
           .resize(positionFooter)
});