Created
December 1, 2010 10:00
-
-
Save yvesvanbroekhoven/723271 to your computer and use it in GitHub Desktop.
Set window min / max height on resize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
window.setWindowMinMaxDimensions = function(){ | |
var min_height = 680; | |
var max_height = '100%'; | |
var min_width = 950; | |
var max_width = 'auto'; | |
window.onresize = function() { | |
var height = document.documentElement.clientHeight; | |
if (height < min_height) { | |
document.body.style.height = min_height + 'px'; | |
} else { | |
document.body.style.height = max_height; | |
} | |
var width = document.documentElement.clientWidth; | |
if (width < min_width) { | |
document.body.style.width = min_width + 'px'; | |
} else { | |
document.body.style.width = max_width; | |
} | |
}; | |
}; | |
setWindowMinMaxDimensions(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment