2015-11-09 21:18:24 +00:00
|
|
|
(function(){
|
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
var mainContentMin = 600;
|
2015-11-09 21:18:24 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
var Init = {
|
2015-11-09 21:18:24 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
start: function(){
|
|
|
|
var classname = this.hasClass(document.body, 'page-sub');
|
2015-11-09 21:18:24 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
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(){
|
|
|
|
|
|
|
|
var header = document.getElementById('header'),
|
|
|
|
footer = document.getElementById('footer'),
|
|
|
|
main = document.getElementById('main-content'),
|
|
|
|
vp = window.innerHeight,
|
|
|
|
bodyHeight = document.body.clientHeight,
|
|
|
|
hHeight = header.clientHeight,
|
|
|
|
fHeight = footer.clientHeight,
|
|
|
|
withMinHeight = hHeight + fHeight + mainContentMin;
|
|
|
|
|
|
|
|
if(withMinHeight < vp && bodyHeight < vp){
|
|
|
|
var newHeight = mainContentMin + (vp-withMinHeight) + 'px';
|
|
|
|
main.style.height = newHeight;
|
|
|
|
}
|
2015-11-09 21:18:24 +00:00
|
|
|
}
|
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
};
|
2015-11-09 21:18:24 +00:00
|
|
|
|
2015-11-09 21:48:29 +00:00
|
|
|
Init.start();
|
2015-11-09 21:18:24 +00:00
|
|
|
|
|
|
|
})();
|