mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-14 17:43:10 +00:00
removed "none" transition handler from Nav.js. Updated the new out-in transition handler so that it supports "none" transitions in addition to our new default css3 animation sequence. The new transition handler is set as the default, and available publicly as $.mobile.defaultTransitionHandler and $.mobile.transitionHandlers["default"].
This commit is contained in:
parent
22162fd5e7
commit
70ef725952
2 changed files with 23 additions and 68 deletions
|
|
@ -504,7 +504,7 @@ define( [
|
|||
//find the transition handler for the specified transition. If there
|
||||
//isn't one in our transitionHandlers dictionary, use the default one.
|
||||
//call the handler immediately to kick-off the transition.
|
||||
var th = $.mobile.transitionHandlers[transition || "none"] || $.mobile.defaultTransitionHandler,
|
||||
var th = $.mobile.transitionHandlers[ transition || "default" ] || $.mobile.defaultTransitionHandler,
|
||||
promise = th( transition, reverse, toPage, fromPage );
|
||||
|
||||
promise.done(function() {
|
||||
|
|
@ -581,58 +581,7 @@ define( [
|
|||
|
||||
$.mobile.dialogHashKey = dialogHashKey;
|
||||
|
||||
//default non-animation transition handler
|
||||
$.mobile.noneTransitionHandler = function( name, reverse, $to, $from ) {
|
||||
var active = $.mobile.urlHistory.getActive(),
|
||||
touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled,
|
||||
toScroll = active.lastScroll || ( touchOverflow ? 0 : $.mobile.defaultHomeScroll ),
|
||||
viewportClass = "ui-mobile-viewport-transitioning viewport-" + name,
|
||||
screenHeight = $.mobile.getScreenHeight();
|
||||
|
||||
if( !touchOverflow){
|
||||
$to.height( screenHeight + toScroll );
|
||||
}
|
||||
|
||||
if( touchOverflow && toScroll ){
|
||||
|
||||
$to.addClass( "ui-mobile-pre-transition" );
|
||||
|
||||
// Send focus to page as it is now display: block
|
||||
$.mobile.focusPage( $to );
|
||||
|
||||
//set page's scrollTop to remembered distance
|
||||
if( $to.is( ".ui-native-fixed" ) ){
|
||||
$to.find( ".ui-content" ).scrollTop( toScroll );
|
||||
}
|
||||
else{
|
||||
$to.scrollTop( toScroll );
|
||||
}
|
||||
}
|
||||
|
||||
//clear page loader
|
||||
$.mobile.hidePageLoadingMsg();
|
||||
|
||||
if ( $from ) {
|
||||
$from.removeClass( $.mobile.activePageClass );
|
||||
}
|
||||
|
||||
$to.addClass( $.mobile.activePageClass );
|
||||
|
||||
// Jump to top or prev scroll, sometimes on iOS the page has not rendered yet.
|
||||
if( !touchOverflow ){
|
||||
$.mobile.silentScroll( toScroll );
|
||||
}
|
||||
|
||||
return $.Deferred().resolve( name, reverse, $to, $from ).promise();
|
||||
};
|
||||
|
||||
//default handler for unknown transitions
|
||||
$.mobile.defaultTransitionHandler = $.mobile.noneTransitionHandler;
|
||||
|
||||
//transition handler dictionary for 3rd party transitions
|
||||
$.mobile.transitionHandlers = {
|
||||
none: $.mobile.defaultTransitionHandler
|
||||
};
|
||||
|
||||
|
||||
//enable cross-domain page support
|
||||
$.mobile.allowCrossDomainPages = false;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
|
|||
toScroll = active.lastScroll || ( touchOverflow ? 0 : $.mobile.defaultHomeScroll ),
|
||||
screenHeight = $.mobile.getScreenHeight(),
|
||||
viewportClass = "ui-mobile-viewport-transitioning viewport-" + name,
|
||||
none = !$.support.cssTransitions || !name || name === "none",
|
||||
doneOut = function() {
|
||||
|
||||
if ( $from ) {
|
||||
|
|
@ -21,9 +22,11 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
|
|||
.height( "" );
|
||||
}
|
||||
|
||||
$to
|
||||
.animationComplete( doneIn )
|
||||
.addClass( $.mobile.activePageClass );
|
||||
$to.addClass( $.mobile.activePageClass );
|
||||
|
||||
if( !none ){
|
||||
$to.animationComplete( doneIn );
|
||||
}
|
||||
|
||||
// Send focus to page as it is now display: block
|
||||
$.mobile.focusPage( $to );
|
||||
|
|
@ -45,13 +48,16 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
|
|||
|
||||
$.mobile.silentScroll( toScroll );
|
||||
}
|
||||
|
||||
|
||||
$to.addClass( name + " in" + reverseClass );
|
||||
|
||||
if( none ){
|
||||
doneIn();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
doneIn = function() {
|
||||
|
||||
$to
|
||||
.removeClass( "out in reverse " + name )
|
||||
.parent().removeClass( viewportClass )
|
||||
|
|
@ -66,10 +72,10 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
|
|||
//clear page loader
|
||||
$.mobile.hidePageLoadingMsg();
|
||||
|
||||
if ( $from ) {
|
||||
if ( $from && !none ) {
|
||||
$from
|
||||
.height( screenHeight + $(window ).scrollTop() )
|
||||
.animationComplete( doneOut )
|
||||
.height( screenHeight + $(window ).scrollTop() )
|
||||
.addClass( name + " out" + reverseClass );
|
||||
}
|
||||
else {
|
||||
|
|
@ -79,15 +85,15 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
// Make our transition handler public.
|
||||
$.mobile.outInTransitionHandler = outInTransitionHandler;
|
||||
|
||||
// If the default transition handler is the 'none' handler, replace it with our handler.
|
||||
if ( $.mobile.defaultTransitionHandler === $.mobile.noneTransitionHandler ) {
|
||||
$.mobile.defaultTransitionHandler = outInTransitionHandler;
|
||||
}
|
||||
|
||||
// add class for where 3d transforms are supported, or not
|
||||
$( "html" ).addClass( $.support.cssTransform3d ? "ui-supported-csstransform3d" : "ui-unsupported-csstransform3d" );
|
||||
|
||||
// Make our transition handler the public default.
|
||||
$.mobile.defaultTransitionHandler = outInTransitionHandler;
|
||||
|
||||
//transition handler dictionary for 3rd party transitions
|
||||
$.mobile.transitionHandlers = {
|
||||
"default": $.mobile.defaultTransitionHandler
|
||||
};
|
||||
|
||||
})( jQuery, this );
|
||||
|
|
|
|||
Loading…
Reference in a new issue