Skip to content

Instantly share code, notes, and snippets.

@FernE97
Created March 28, 2013 19:15
Show Gist options
  • Save FernE97/5265988 to your computer and use it in GitHub Desktop.
Save FernE97/5265988 to your computer and use it in GitHub Desktop.
JS: Modernizr media query
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