goranseric
6/19/2014 - 8:46 AM

modernizr-mq.js

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));