add the ability to disable native orientation change support Fixes #793

the frequency of the triggered event in certain android releases ( 2.1, 2.2) appears to be dependent on a host of things other than an actual orientation change, eg alerts, zoom, and scrolling. This provides a way for the user to disable it in favor for using throttled resize while still making use of the window.orientation where its available for reliability
This commit is contained in:
John Bender 2011-10-04 11:48:01 -07:00
parent ff9720281b
commit 57079e1d6b
2 changed files with 6 additions and 2 deletions

View file

@ -53,6 +53,9 @@
pushStateEnabled: true,
// turn of binding to the native orientationchange due to android orientation behavior
orientationChangeEnabled: true,
// Support conditions that must be met in order to proceed
// default enhanced qualifications are media query support OR IE 7+
gradeA: function(){

View file

@ -190,7 +190,7 @@ $.event.special.swipe = {
setup: function() {
// If the event is supported natively, return false so that jQuery
// will bind to the event using DOM methods.
if ( $.support.orientation ) {
if ( $.support.orientation && $.mobile.orientationChangeEnabled ) {
return false;
}
@ -204,7 +204,7 @@ $.event.special.swipe = {
teardown: function(){
// If the event is not supported natively, return false so that
// jQuery will unbind the event using DOM methods.
if ( $.support.orientation ) {
if ( $.support.orientation && $.mobile.orientationChangeEnabled ) {
return false;
}
@ -216,6 +216,7 @@ $.event.special.swipe = {
// Save a reference to the bound event handler.
var old_handler = handleObj.handler;
handleObj.handler = function( event ) {
// Modify event object, adding the .orientation property.
event.orientation = get_orientation();