mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-17 06:20:26 +00:00
- So it seems just allowing changePage() to process same toPage and fromPage is not enough. I modified the CSS3 keyframe animation plugin so that it only removes the ui-page-active class from the fromPage if it is *NOT* the same as the toPage. - I also re-ordered the in/out transition rules for forward/reverse transitions so that the user always views some sort of animation/motion.
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
/*!
|
|
* jQuery Mobile v@VERSION
|
|
* http://jquerymobile.com/
|
|
*
|
|
* Copyright 2010, jQuery Project
|
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
* http://jquery.org/license
|
|
*/
|
|
|
|
(function( $, window, undefined ) {
|
|
|
|
function css3TransitionHandler( name, reverse, $to, $from ) {
|
|
|
|
var deferred = new $.Deferred(),
|
|
reverseClass = reverse ? " reverse" : "",
|
|
viewportClass = "ui-mobile-viewport-transitioning viewport-" + name,
|
|
doneFunc = function() {
|
|
|
|
$to.add( $from ).removeClass( "out in reverse " + name );
|
|
|
|
if ( $from && $from[ 0 ] !== $to[ 0 ] ) {
|
|
$from.removeClass( $.mobile.activePageClass );
|
|
}
|
|
|
|
$to.parent().removeClass( viewportClass );
|
|
|
|
deferred.resolve( name, reverse, $to, $from );
|
|
};
|
|
|
|
$to.animationComplete( doneFunc );
|
|
|
|
$to.parent().addClass( viewportClass );
|
|
|
|
if ( $from ) {
|
|
$from.addClass( name + " out" + reverseClass );
|
|
}
|
|
$to.addClass( $.mobile.activePageClass + " " + name + " in" + reverseClass );
|
|
|
|
return deferred.promise();
|
|
}
|
|
|
|
// Make our transition handler public.
|
|
$.mobile.css3TransitionHandler = css3TransitionHandler;
|
|
|
|
// If the default transition handler is the 'none' handler, replace it with our handler.
|
|
if ( $.mobile.defaultTransitionHandler === $.mobile.noneTransitionHandler ) {
|
|
$.mobile.defaultTransitionHandler = css3TransitionHandler;
|
|
}
|
|
|
|
})( jQuery, this );
|