Skip to content

Commit

Permalink
Added detection for CSS vmin unit. http://jsfiddle.net/glsee/JRmdq/8/
Browse files Browse the repository at this point in the history
  • Loading branch information
glsee committed Jul 21, 2012
1 parent 60a87ac commit c85db37
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions feature-detects/css-vminunit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// https://github.com/Modernizr/Modernizr/issues/572
// http://jsfiddle.net/glsee/JRmdq/8/
Modernizr.addTest('cssvminunit', function(){
var bool;
Modernizr.testStyles("#modernizr { width: 50vmin; }", function(elem, rule) {
var one_vw = window.innerWidth/100,
one_vh = window.innerHeight/100,
compWidth = parseInt((window.getComputedStyle ?
getComputedStyle(elem, null) :
elem.currentStyle)['width'],10);
bool = !!( parseInt(Math.min(one_vw, one_vh)*50,10) == compWidth );
});
return bool;
});

0 comments on commit c85db37

Please sign in to comment.