Created
March 28, 2013 19:15
-
-
Save FernE97/5265988 to your computer and use it in GitHub Desktop.
JS: Modernizr media query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function ($) { | |
'use strict'; | |
function doneResizing() { | |
if (Modernizr.mq('screen and (min-width:768px)')) { | |
// action for screen widths including and above 768 pixels | |
} else if (Modernizr.mq('screen and (max-width:767px)')) { | |
// action for screen widths below 768 pixels | |
} | |
} | |
var id; | |
$(window).resize(function () { | |
clearTimeout(id); | |
id = setTimeout(doneResizing, 0); | |
}); | |
doneResizing(); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment