Min-width & max-width for IE


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. window.attachEvent('onload', mkwidth);
  2. window.attachEvent('onresize', mkwidth);
  3.  
  4. var minwidth = document.getElementById("site").currentStyle['min-width'].replace('px', '');
  5. var maxwidth = document.getElementById("site").currentStyle['max-width'].replace('px', '');
  6.  
  7. function mkwidth(){
  8. document.getElementById("site").style.width = document.documentElement.clientWidth < minwidth ? minwidth+"px" : (document.documentElement.clientWidth > maxwidth ? maxwidth+"px" : "100%");
  9. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.