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


has noticed behavior? i'm trying write script trigger upon resize. works fine on normal browsers, works fine on iphone, on ipad, trigger going horizontal vertical viewport, not vice versa.

here's 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 {              /* stuff. */     }; }); 

if understood correctly, want when user tilts ipad. here go:

window.onorientationchange = function(){      var orientation = window.orientation;      // @ value of window.orientation:      if (orientation === 0){          // ipad in portrait mode.      }      else if (orientation === 90){          // ipad in landscape mode. screen turned left.      }       else if (orientation === -90){          // ipad in landscape mode. screen turned right.      }  } 

the left picture shows portrait mode, right 1 landscape mode


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -