sigil88
11/16/2016 - 4:55 PM

jquery / js resize window http://stackoverflow.com/questions/9720294/jquery-how-to-detect-window-width-on-the-fly

// from here: http://stackoverflow.com/questions/9720294/jquery-how-to-detect-window-width-on-the-fly

$(document).ready(function() {
    // Optimalisation: Store the references outside the event handler:
    var $window = $(window);
    var $pane = $('#pane1');

    function checkWidth() {
        var windowsize = $window.width();
        if (windowsize > 440) {
            //if the window is greater than 440px wide then turn on jScrollPane..
            $pane.jScrollPane({
               scrollbarWidth:15, 
               scrollbarMargin:52
            });
        }
    }
    // Execute on load
    checkWidth();
    // Bind event listener
    $(window).resize(checkWidth);
});