iPad doesn't trigger resize event going from vertical to horizontal?

Posted by dclowd9901 on Stack Overflow See other posts from Stack Overflow or by dclowd9901
Published on 2010-04-29T21:21:06Z Indexed on 2010/04/30 10:37 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
|

Has anyone noticed this behavior? I'm trying to write a script that will trigger upon a resize. It works fine on normal browsers, works fine on iPhone, but on iPad, will only trigger going from horizontal to vertical viewport, not vice versa.

Here's the code:

$(window).resize( function() {

    var agent=navigator.userAgent.toLowerCase();
    var is_iphone = ((agent.indexOf('iphone') != -1));
    var is_ipad = ((agent.indexOf('ipad') != -1));

    if(is_iphone || is_ipad){
        location.reload(true);
    } else {     
        /* Do stuff. */
    };
});

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery