< Back to Coding, jQuery

Using JS to mimic media queries

Sometimes this is required. To do this use:

var winSize = window.outerWidth;
if(winSize === undefined){
            winSize = $(window).width();
        if (winSize > 480) {
            // change style for non-mobile
        } else {
           // change style for mobile

View the demo

Download the demo

Leave a Reply

Your email address will not be published. Required fields are marked *