css-vhunit.js 541 B

1234567891011121314
  1. // https://github.com/Modernizr/Modernizr/issues/572
  2. // Similar to http://jsfiddle.net/FWeinb/etnYC/
  3. Modernizr.addTest('cssvhunit', function() {
  4. var bool;
  5. Modernizr.testStyles("#modernizr { height: 50vh; }", function(elem, rule) {
  6. var height = parseInt(window.innerHeight/2,10),
  7. compStyle = parseInt((window.getComputedStyle ?
  8. getComputedStyle(elem, null) :
  9. elem.currentStyle)["height"],10);
  10. bool= (compStyle == height);
  11. });
  12. return bool;
  13. });