Websnippetz

Get cool snippets on php, css, jQuery, Magento and wordpress

Set your footer sticky at the bottom of the page

It time to show your footer bar sticky at the bottom of the page, just go though the script

<br />$(window).bind(&quot;load&quot;, function() { <br /><br />       var footerHeight = 0,<br />           footerTop = 0,<br />           $footer = $(&quot;footer&quot;);//Added your footer id over here<br /><br />       positionFooter();<br /><br />       function positionFooter() {<br /><br />                footerHeight = $footer.height();<br />                footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+&quot;px&quot;;<br /><br />               if ( ($(document.body).height()+footerHeight) &amp;lt; $(window).height()) {<br />                   $footer.css({<br />                        position: &quot;absolute&quot;<br />                   }).animate({<br />                        top: footerTop<br />                   })<br />               } else {<br />                   $footer.css({<br />                        position: &quot;static&quot;<br />                   })<br />               }<br /><br />       }<br /><br />       $(window)<br />               .scroll(positionFooter)<br />               .resize(positionFooter)<br /><br />});<br />

karthi s

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: