Skip to content

Instantly share code, notes, and snippets.

@goranseric
Forked from FernE97/modernizr-mq.js
Created June 19, 2014 08:46
Show Gist options
  • Save goranseric/807e3c366edd2f2eb3d5 to your computer and use it in GitHub Desktop.
Save goranseric/807e3c366edd2f2eb3d5 to your computer and use it in GitHub Desktop.
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