Skip to content

awhite.ca

Cambridge area web developer

Modify the viewport based on screen width

Posted byAndrew October 16, 2012July 3, 2013

The following snippet will cause mobile browsers to zoom in 320px of content. Useful for responsive design with fixed widths at the various breakpoints. Depends on JQuery.

<script>
    if ($(window).width() <= 640) {
        $('meta[name=viewport]').attr('content','width=320, user-scalable=1');
    }
</script>
Posted byAndrewOctober 16, 2012July 3, 2013Posted inCode SnippetTags: javascript, jquery, responsive design

Post navigation

Previous Post Previous post:
Weekly link dump
Next Post Next post:
Weekly link dump
awhite.ca, Proudly powered by WordPress.