希望这对你有用 http://jsfiddle.net/8YWHn/
的CSS
.fixed {
position:fixed;
bottom:0px;
-webkit-backface-visibility:hidden;
}
js
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()) {
$footer.css({
position: "absolute"
}).animate({
top: footerTop
})
} else {
$footer.addClass('fixed');
}
}
$(window)
.scroll(positionFooter)
.resize(positionFooter)