css-vminunit.js 615 B

1234567891011121314
  1. // https://github.com/Modernizr/Modernizr/issues/572
  2. // http://jsfiddle.net/glsee/JRmdq/8/
  3. Modernizr.addTest('cssvminunit', function(){
  4. var bool;
  5. Modernizr.testStyles("#modernizr { width: 50vmin; }", 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.min(one_vw, one_vh)*50,10) == compWidth );
  12. });
  13. return bool;
  14. });