Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
implemented fallback transition definitions for non-3D-supporting bro…
Browse files Browse the repository at this point in the history
…wsers, for all transitions except "fade". By default, these are all set to fall back to "fade", and they'll fall back to "none" if 3D is unsupported and no fallback is defined. They can be overridden at mobileinit, like any other jQM default.
  • Loading branch information
scottjehl committed Jan 13, 2012
1 parent a237c5f commit a3e7762
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/index.php
Expand Up @@ -18,6 +18,12 @@
'jquery.mobile.navigation.js',
'jquery.mobile.navigation.pushstate.js',
'jquery.mobile.transition.js',
'jquery.mobile.transition.js',
'jquery.mobile.transition.pop.js',
'jquery.mobile.transition.slide.js',
'jquery.mobile.transition.slidedown.js',
'jquery.mobile.transition.slideup.js',
'jquery.mobile.transition.flip.js',
'jquery.mobile.degradeInputs.js',
'jquery.mobile.dialog.js',
'jquery.mobile.page.sections.js',
Expand Down
9 changes: 9 additions & 0 deletions js/jquery.mobile.transition.flip.js
@@ -0,0 +1,9 @@
/*
* fallback transition for flip in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/

(function( $, window, undefined ) {

$.mobile.transitionFallbacks.flip = "fade";

})( jQuery, this );
7 changes: 7 additions & 0 deletions js/jquery.mobile.transition.js
Expand Up @@ -6,6 +6,11 @@

function outInTransitionHandler( name, reverse, $to, $from ) {

// first, override name if there's no 3D transform support and a fallback is defined
if( name && !$.support.cssTransform3d ){
name = $.mobile.transitionFallbacks[ name ] || "none";
}

var deferred = new $.Deferred(),
reverseClass = reverse ? " reverse" : "",
active = $.mobile.urlHistory.getActive(),
Expand Down Expand Up @@ -97,4 +102,6 @@ $.mobile.transitionHandlers = {
"default": $.mobile.defaultTransitionHandler
};

$.mobile.transitionFallbacks = {};

})( jQuery, this );
9 changes: 9 additions & 0 deletions js/jquery.mobile.transition.pop.js
@@ -0,0 +1,9 @@
/*
* fallback transition for pop in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/

(function( $, window, undefined ) {

$.mobile.transitionFallbacks.pop = "fade";

})( jQuery, this );
9 changes: 9 additions & 0 deletions js/jquery.mobile.transition.slide.js
@@ -0,0 +1,9 @@
/*
* fallback transition for slide in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/

(function( $, window, undefined ) {

$.mobile.transitionFallbacks.slide = "fade";

})( jQuery, this );
9 changes: 9 additions & 0 deletions js/jquery.mobile.transition.slidedown.js
@@ -0,0 +1,9 @@
/*
* fallback transition for slidedown in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/

(function( $, window, undefined ) {

$.mobile.transitionFallbacks.slidedown = "fade";

})( jQuery, this );
9 changes: 9 additions & 0 deletions js/jquery.mobile.transition.slideup.js
@@ -0,0 +1,9 @@
/*
* fallback transition for slideup in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/

(function( $, window, undefined ) {

$.mobile.transitionFallbacks.slideup = "fade";

})( jQuery, this );

0 comments on commit a3e7762

Please sign in to comment.