JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://modernizr.com/downloads/modernizr-2.5.3.js"></script>
<p>BEGIN</p>
JavaScript
function checkMq() {
if (Modernizr.mq('(min-width: 600px)')) {
$('<div>')
.attr('id','small')
.html('siamo ---oltre---- i 600px')
.appendTo('body')
} else {
$('<div>')
.attr('id','wide')
.html('siamo ---sotto--- i 600px')
.appendTo('body')
}
}
$(function() {
// the call to checkMq here will execute after the document has loaded
//checkMq();
$(window).resize(function() {
// the call to checkMq here will execute every time the window is resized
checkMq();
});
// you can add other listeners here click, hover, etc.
});
checkMq();