ServerBloke ServerBloke - 1 year ago 170
jQuery Question

Javascript get mobile screen width after orientation change

I am capturing the

event like this:

$(window).bind( 'orientationchange', function(e){


How can I get the new screen width and height in pixels after the

I have tried
but this doesn't change, it remains as the initial width, even after orientation change.

Answer Source
$(window).bind( 'orientationchange', function(e){
    var ori = window.orientation,
        width = (ori==90 || ori==-90) ? screen.height : screen.width;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download