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
[code lang="js"]
$(window).bind("load", function() {
var footerHeight = 0,
footerTop = 0,
$footer = $("footer");//Added your footer id over here
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.css({
position: "static"
})
}
}
$(window)
.scroll(positionFooter)
.resize(positionFooter)
});
[/code]
[code lang="js"]
$(window).bind("load", function() {
var footerHeight = 0,
footerTop = 0,
$footer = $("footer");//Added your footer id over here
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.css({
position: "static"
})
}
}
$(window)
.scroll(positionFooter)
.resize(positionFooter)
});
[/code]
Comments
Post a Comment