/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
window.attachEvent('onload', mkwidth); window.attachEvent('onresize', mkwidth); var minwidth = document.getElementById("site").currentStyle['min-width'].replace('px', ''); var maxwidth = document.getElementById("site").currentStyle['max-width'].replace('px', ''); function mkwidth(){ document.getElementById("site").style.width = document.documentElement.clientWidth < minwidth ? minwidth+"px" : (document.documentElement.clientWidth > maxwidth ? maxwidth+"px" : "100%"); };