/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//footer stick $(window).bind("load", function() { var footerHeight = 0, footerTop = 0, $footer = $("#footer"); positionFooter(); function positionFooter() { footerHeight = $footer.outerHeight(); footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px"; if ( ($(document.body).height()+footerHeight) < $(window).height()) { $footer.css({ position: "absolute", top: footerTop }); } else { $footer.css({ position: "static" }); } }; $(window) .scroll(positionFooter) .resize(positionFooter); });
Comments
