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

Commit

Permalink
Fixes #2529 - Transition to the same page
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
jblas committed Sep 28, 2011
1 parent 2b2935b commit ca9df11
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion js/jquery.mobile.transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function css3TransitionHandler( name, reverse, $to, $from ) {

$to.add( $from ).removeClass( "out in reverse " + name );

if ( $from ) {
if ( $from && $from[ 0 ] !== $to[ 0 ] ) {
$from.removeClass( $.mobile.activePageClass );
}

Expand Down
74 changes: 38 additions & 36 deletions themes/default/jquery.mobile.transitions.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,41 @@ Built by David Kaneda and maintained by Jonathan Stark.
-webkit-animation-duration: 350ms;
}

.slide.in {
-webkit-transform: translateX(0);
-webkit-animation-name: slideinfromright;
}

.slide.out {
-webkit-transform: translateX(-100%);
-webkit-animation-name: slideouttoleft;
}

.slide.in.reverse {
.slide.in {
-webkit-transform: translateX(0);
-webkit-animation-name: slideinfromleft;
-webkit-animation-name: slideinfromright;
}

.slide.out.reverse {
-webkit-transform: translateX(100%);
-webkit-animation-name: slideouttoright;
}

.slide.in.reverse {
-webkit-transform: translateX(0);
-webkit-animation-name: slideinfromleft;
}

.slideup.out {
-webkit-animation-name: dontmove;
z-index: 0;
}

.slideup.in {
-webkit-transform: translateY(0);
-webkit-animation-name: slideinfrombottom;
z-index: 10;
}

.slideup.out {
-webkit-animation-name: dontmove;
.slideup.in.reverse {
z-index: 0;
-webkit-animation-name: dontmove;
}

.slideup.out.reverse {
Expand All @@ -60,19 +66,20 @@ Built by David Kaneda and maintained by Jonathan Stark.
-webkit-animation-name: slideouttobottom;
}

.slideup.in.reverse {
z-index: 0;
.slidedown.out {
-webkit-animation-name: dontmove;
z-index: 0;
}

.slidedown.in {
-webkit-transform: translateY(0);
-webkit-animation-name: slideinfromtop;
z-index: 10;
}

.slidedown.out {
-webkit-animation-name: dontmove;
.slidedown.in.reverse {
z-index: 0;
-webkit-animation-name: dontmove;
}

.slidedown.out.reverse {
Expand All @@ -81,11 +88,6 @@ Built by David Kaneda and maintained by Jonathan Stark.
-webkit-animation-name: slideouttotop;
}

.slidedown.in.reverse {
z-index: 0;
-webkit-animation-name: dontmove;
}

@-webkit-keyframes slideinfromright {
from { -webkit-transform: translateX(100%); }
to { -webkit-transform: translateX(0); }
Expand All @@ -106,7 +108,6 @@ Built by David Kaneda and maintained by Jonathan Stark.
to { -webkit-transform: translateX(100%); }
}


@-webkit-keyframes slideinfromtop {
from { -webkit-transform: translateY(-100%); }
to { -webkit-transform: translateY(0); }
Expand Down Expand Up @@ -136,15 +137,16 @@ Built by David Kaneda and maintained by Jonathan Stark.
to { opacity: 0; }
}

.fade.out {
z-index: 0;
-webkit-animation-name: fadeout;
}

.fade.in {
opacity: 1;
z-index: 10;
-webkit-animation-name: fadein;
}
.fade.out {
z-index: 0;
-webkit-animation-name: fadeout;
}

/* The properties in this rule are only necessary for the 'flip' transition.
* We need specify the perspective to create a projection matrix. This will add
Expand All @@ -170,28 +172,28 @@ Built by David Kaneda and maintained by Jonathan Stark.
-webkit-transform:translateX(0); /* Needed to work around an iOS 3.1 bug that causes listview thumbs to disappear when -webkit-visibility:hidden is used. */
}

.flip.in {
-webkit-transform: rotateY(0) scale(1);
-webkit-animation-name: flipinfromleft;
}

.flip.out {
-webkit-transform: rotateY(-180deg) scale(.8);
-webkit-animation-name: flipouttoleft;
}

/* Shake it all about */

.flip.in.reverse {
.flip.in {
-webkit-transform: rotateY(0) scale(1);
-webkit-animation-name: flipinfromright;
-webkit-animation-name: flipinfromleft;
}

/* Shake it all about */

.flip.out.reverse {
-webkit-transform: rotateY(180deg) scale(.8);
-webkit-animation-name: flipouttoright;
}

.flip.in.reverse {
-webkit-transform: rotateY(0) scale(1);
-webkit-animation-name: flipinfromright;
}

@-webkit-keyframes flipinfromright {
from { -webkit-transform: rotateY(-180deg) scale(.8); }
to { -webkit-transform: rotateY(0) scale(1); }
Expand Down Expand Up @@ -231,18 +233,18 @@ Built by David Kaneda and maintained by Jonathan Stark.
z-index: 10;
}

.pop.in.reverse {
z-index: 0;
-webkit-animation-name: dontmove;
}

.pop.out.reverse {
-webkit-transform: scale(.2);
opacity: 0;
-webkit-animation-name: popout;
z-index: 10;
}

.pop.in.reverse {
z-index: 0;
-webkit-animation-name: dontmove;
}

@-webkit-keyframes popin {
from {
-webkit-transform: scale(.2);
Expand Down

0 comments on commit ca9df11

Please sign in to comment.