JSFiddle - React, Tailwind, and code Playground

by glsee

HTML

<script src="http://modernizr.com/downloads/modernizr-2.5.3.js"></script>
<div id="vmin"></div>

CSS

#vmin {background: green; width: 100%; height: 50vmin;}

JavaScript

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);
        console.log(window.innerWidth);
        console.log(window.innerHeight);
        console.log(parseInt(Math.min(one_vw, one_vh)*50,10));
        console.log(compWidth);
        bool = !!( parseInt(Math.min(one_vw, one_vh)*50,10) == compWidth );
    });
    return bool;
});

console.log(Modernizr.cssvminunit);