css-vmaxunit.js 614 B

1234567891011121314
  1. // https://github.com/Modernizr/Modernizr/issues/572
  2. // http://jsfiddle.net/glsee/JDsWQ/4/
  3. Modernizr.addTest('cssvmaxunit', function(){
  4. var bool;
  5. Modernizr.testStyles("#modernizr { width: 50vmax; }", function(elem, rule) {
  6. var one_vw = window.innerWidth/100,
  7. one_vh = window.innerHeight/100,
  8. compWidth = parseInt((window.getComputedStyle ?
  9. getComputedStyle(elem, null) :
  10. elem.currentStyle)['width'],10);
  11. bool = ( parseInt(Math.max(one_vw, one_vh)*50,10) == compWidth );
  12. });
  13. return bool;
  14. });