-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstickyFooter.js
34 lines (24 loc) · 885 Bytes
/
stickyFooter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$(document).ready(function() {
var footerHeight = 0,
footerTop = 0,
$footer = $("#footerContain");
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
}, -1)
} else {
$footer.css({
position: "static"
})
}
}
$(window).resize(function() {
positionFooter();
});
});