Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Finally fixed StickyFooter For Real
Browse files Browse the repository at this point in the history
Had to calculate in heights for UC Header and Wp Admin bar.
  • Loading branch information
andrewmbacon committed Jan 9, 2015
1 parent ccab2d9 commit 13c097f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions js/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,36 +219,42 @@ jQuery(document).ready(function($) {
// measures height of the page, and applies a class to absolute position the footer, or not.
// on short pages, it sticks; on tall pages, it doesn't.

var wrapperH = $('#page').height();
var wrapperH = $('#page').outerHeight();
var wpadminbarH = $('#wpadminbar').outerHeight();
var ucheaderH = $('#uc-header').outerHeight();

function stickyFoot(wrapperHeight){
console.log('wrapperh: '+wrapperH);
if (document.getElementById('page')!=null && document.getElementById('footers') !=null){
var footerH = document.getElementById('footers').clientHeight
var footerH = $('#footers').outerHeight();
console.log('footerH: '+footerH);

var windowH = window.innerHeight;
console.log('windowH: '+windowH);
windowH = windowH - wpadminbarH - ucheaderH;
console.log('windowH: '+windowH);
if(windowH>=wrapperHeight){
console.log('window frame TALLER than page contents');
$('body').addClass('sticky');
} else {
console.log('window frame SMALLER than page contents');

$('body').removeClass('sticky');
}
}
}
window.onload = function (){
placeholderSupport = ("placeholder" in document.createElement("input"));
if(placeholderSupport!=false){
var d = $('main');
d.addClass("supports-placeholder");
}
stickyFoot(wrapperH);
}
window.onresize = function() {
stickyFoot(wrapperH);
}

$('.panel').on('shown.bs.collapse', function (e) {
stickyFoot();
stickyFoot(wrapperH);
})
$('.panel').on('hidden.bs.collapse', function (e) {
stickyFoot();
stickyFoot(wrapperH);
})

})
2 changes: 1 addition & 1 deletion js/min/cs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13c097f

Please sign in to comment.