mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-01-24 08:00:27 -05:00
update footer to be sticky
This commit is contained in:
47
website/source/javascripts/docs.js
Normal file
47
website/source/javascripts/docs.js
Normal file
@@ -0,0 +1,47 @@
|
||||
(function(){
|
||||
|
||||
var Init = {
|
||||
|
||||
start: function(){
|
||||
var classname = this.hasClass(document.body, 'page-sub');
|
||||
|
||||
if (classname) {
|
||||
this.addEventListeners();
|
||||
}
|
||||
},
|
||||
|
||||
hasClass: function (elem, className) {
|
||||
return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
|
||||
},
|
||||
|
||||
addEventListeners: function(){
|
||||
var _this = this;
|
||||
//console.log(document.querySelectorAll('.navbar-static-top')[0]);
|
||||
window.addEventListener('resize', _this.resizeImage, false);
|
||||
|
||||
this.resizeImage();
|
||||
},
|
||||
|
||||
resizeImage: function(){
|
||||
console.log('resizeImage')
|
||||
|
||||
var header = document.getElementById('header'),
|
||||
footer = document.getElementById('footer-wrap'),
|
||||
main = document.getElementById('main-content'),
|
||||
vp = window.innerHeight,
|
||||
bodyHeight = document.body.clientHeight,
|
||||
hHeight = header.clientHeight,
|
||||
fHeight = footer.clientHeight,
|
||||
withMinHeight = hHeight + fHeight + 830;
|
||||
|
||||
if(withMinHeight > bodyHeight ){
|
||||
var newHeight = (vp - (hHeight+fHeight)) + 'px';
|
||||
main.style.height = newHeight;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Init.start();
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user