jquery-mobile/css/structure/jquery.mobile.transitions.css

400 lines
9.3 KiB
CSS
Raw Normal View History

/* Transitions from jQtouch (with small modifications): http://www.jqtouch.com/
Built by David Kaneda and maintained by Jonathan Stark.
*/
.in {
-webkit-animation-timing-function: ease-out;
-webkit-animation-duration: 325ms;
-moz-animation-timing-function: ease-out;
-moz-animation-duration: 325ms;
}
.out {
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 250ms;
-moz-animation-timing-function: ease-in;
2012-01-02 18:57:30 +00:00
-moz-animation-duration: 250ms;
}
.slide.out {
-webkit-transform: translateX(-100%);
-webkit-animation-name: slideouttoleft;
-moz-transform: translateX(-100%);
-moz-animation-name: slideouttoleft;
}
.slide.in {
-webkit-transform: translateX(0);
-webkit-animation-name: fadein;
2012-01-02 17:15:29 +00:00
-moz-transform: translateX(0);
-moz-animation-name: fadein;
}
.slide.out.reverse {
-webkit-transform: translateX(100%);
-webkit-animation-name: slideouttoright;
-moz-transform: translateX(100%);
-moz-animation-name: slideouttoright;
}
.slide.in.reverse {
-webkit-transform: translateX(0);
-webkit-animation-name: fadein;
-moz-transform: translateX(0);
-moz-animation-name: fadein;
}
.slideup.out {
-webkit-animation-name: fadeout;
-moz-animation-name: fadeout;
z-index: 0;
}
.slideup.in {
-webkit-transform: translateY(0);
-webkit-animation-name: slideinfrombottom;
-moz-transform: translateY(0);
-moz-animation-name: slideinfrombottom;
z-index: 10;
}
.slideup.in.reverse {
z-index: 0;
-webkit-animation-name: fadein;
-moz-animation-name: fadein;
}
.slideup.out.reverse {
z-index: 10;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-webkit-animation-name: slideouttobottom;
-moz-animation-name: slideouttobottom;
}
.slidedown.out {
-webkit-animation-name: fadeout;
-moz-animation-name: fadeout;
z-index: 0;
}
.slidedown.in {
-webkit-transform: translateY(0);
-webkit-animation-name: slideinfromtop;
-moz-transform: translateY(0);
-moz-animation-name: slideinfromtop;
z-index: 10;
}
.slidedown.in.reverse {
z-index: 0;
-webkit-animation-name: fadein;
-moz-animation-name: fadein;
}
.slidedown.out.reverse {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
z-index: 10;
-webkit-animation-name: slideouttotop;
-moz-animation-name: slideouttotop;
}
@-webkit-keyframes slideinfromright {
from { -webkit-transform: translateX(100%); }
to { -webkit-transform: translateX(0); }
}
@-moz-keyframes slideinfromright {
from { -moz-transform: translateX(100%); }
to { -moz-transform: translateX(0); }
}
@-webkit-keyframes slideinfromleft {
from { -webkit-transform: translateX(-100%); }
to { -webkit-transform: translateX(0); }
}
@-moz-keyframes slideinfromleft {
from { -moz-transform: translateX(-100%); }
to { -moz-transform: translateX(0); }
}
@-webkit-keyframes slideouttoleft {
from { -webkit-transform: translateX(0); }
to { -webkit-transform: translateX(-100%); }
}
@-moz-keyframes slideouttoleft {
from { -moz-transform: translateX(0); }
to { -moz-transform: translateX(-100%); }
}
@-webkit-keyframes slideouttoright {
from { -webkit-transform: translateX(0); }
to { -webkit-transform: translateX(100%); }
}
@-moz-keyframes slideouttoright {
from { -moz-transform: translateX(0); }
to { -moz-transform: translateX(100%); }
}
@-webkit-keyframes slideinfromtop {
from { -webkit-transform: translateY(-100%); }
to { -webkit-transform: translateY(0); }
}
@-moz-keyframes slideinfromtop {
from { -moz-transform: translateY(-100%); }
to { -moz-transform: translateY(0); }
}
@-webkit-keyframes slideinfrombottom {
from { -webkit-transform: translateY(100%); }
to { -webkit-transform: translateY(0); }
}
@-moz-keyframes slideinfrombottom {
from { -moz-transform: translateY(100%); }
to { -moz-transform: translateY(0); }
}
@-webkit-keyframes slideouttobottom {
from { -webkit-transform: translateY(0); }
to { -webkit-transform: translateY(100%); }
}
@-moz-keyframes slideouttobottom {
from { -moz-transform: translateY(0); }
to { -moz-transform: translateY(100%); }
}
@-webkit-keyframes slideouttotop {
from { -webkit-transform: translateY(0); }
to { -webkit-transform: translateY(-100%); }
}
@-moz-keyframes slideouttotop {
from { -moz-transform: translateY(0); }
to { -moz-transform: translateY(-100%); }
}
@-webkit-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-moz-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-webkit-keyframes fadeout {
from { opacity: 1; }
to { opacity: 0; }
}
@-moz-keyframes fadeout {
from { opacity: 1; }
to { opacity: 0; }
}
.fade.out {
z-index: 0;
opacity: 0;
-webkit-animation-duration: 150ms;
-webkit-animation-name: fadeout;
-moz-animation-duration: 150ms;
-moz-animation-name: fadeout;
}
.fade.in {
opacity: 1;
z-index: 10;
-webkit-animation-duration: 300ms;
-webkit-animation-name: fadein;
-moz-animation-duration: 300ms;
-moz-animation-name: fadein;
}
Changes to allow 3rd party transitions. Developers can now register a custom transition by adding their transition handler to the $.mobile.transitionHandlers dictionary. The name of the custom transition is used as the key within the transtionsHandlers dictionary, and should be the same name used within the @data-transtion attribute. The expected prototype for a transitionHandler is as follows: function handler(name, reverse, $to, $from) The name parameter is the name of the transition as specified by @data-transition attribute, reverse is a boolean that is false for a normal transition, and true for a reverse transition. The $to param is a jQuery collection containing the page that is being transitioned "to", and $from is an optional collection that tells us what page we are transitioning "from". Because $from is optional, handler developers should take care and check $from to make sure it is not undefined before attempting to dereference it. In addition to registering custom transition by name, developers can specify a handler to use in the case where a transition name is specified and does not exist within the $.mobile.transitionHanlders dictionary. Within jQuery Mobile, the default handler for unknown transition types is the $.mobile.css3Transition() handler. This handler always assumes that the transition name is to be used as a CSS class to be placed on the $to and $from elements. To change the default handler, simply set $.mobile.defaultTransitionHandler to you function handler: $.mobile.defaultTransitionHandler = myTransitionHandler; The changes to make all this necessary are as follows: - Created $.mobile.noneTransitionHandler which is the default transitionHandler for the framework that simply adds and removes the page active class on the $from and $to pages with no animations. - Moved class based transition code into a new plugin jquery.mobile.transition.js file. This plugin, when present, overrides the noneTransitionHandler as the defaultTranstionHandler for the framework so that CSS3 animation transitions are available. - Removed code related to the setting/removal of the ui-mobile-viewport-perspective class. The css3TransitionHandler plugin takes care of automatically placing a "viewport-<transition name>" class on the viewport (body) element. This allows any other transition to specify properties on the viewport that are necessary to accomplish the transition. - changed the CSS class ui-mobile-viewport-perspective to viewport-flip to match code changes. This makes it more apparent that setting -webkit-perspective is only used with the flip transition. - Updated js/index.php, Makefile and build.xml to include the new jquery.mobile.transition.js file.
2011-04-26 21:06:10 +00:00
/* 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
* some depth as the element flips. The depth number represents the distance of
* the viewer from the z-plane. According to the CSS3 spec, 1000 is a moderate
* value.
*/
Changes to allow 3rd party transitions. Developers can now register a custom transition by adding their transition handler to the $.mobile.transitionHandlers dictionary. The name of the custom transition is used as the key within the transtionsHandlers dictionary, and should be the same name used within the @data-transtion attribute. The expected prototype for a transitionHandler is as follows: function handler(name, reverse, $to, $from) The name parameter is the name of the transition as specified by @data-transition attribute, reverse is a boolean that is false for a normal transition, and true for a reverse transition. The $to param is a jQuery collection containing the page that is being transitioned "to", and $from is an optional collection that tells us what page we are transitioning "from". Because $from is optional, handler developers should take care and check $from to make sure it is not undefined before attempting to dereference it. In addition to registering custom transition by name, developers can specify a handler to use in the case where a transition name is specified and does not exist within the $.mobile.transitionHanlders dictionary. Within jQuery Mobile, the default handler for unknown transition types is the $.mobile.css3Transition() handler. This handler always assumes that the transition name is to be used as a CSS class to be placed on the $to and $from elements. To change the default handler, simply set $.mobile.defaultTransitionHandler to you function handler: $.mobile.defaultTransitionHandler = myTransitionHandler; The changes to make all this necessary are as follows: - Created $.mobile.noneTransitionHandler which is the default transitionHandler for the framework that simply adds and removes the page active class on the $from and $to pages with no animations. - Moved class based transition code into a new plugin jquery.mobile.transition.js file. This plugin, when present, overrides the noneTransitionHandler as the defaultTranstionHandler for the framework so that CSS3 animation transitions are available. - Removed code related to the setting/removal of the ui-mobile-viewport-perspective class. The css3TransitionHandler plugin takes care of automatically placing a "viewport-<transition name>" class on the viewport (body) element. This allows any other transition to specify properties on the viewport that are necessary to accomplish the transition. - changed the CSS class ui-mobile-viewport-perspective to viewport-flip to match code changes. This makes it more apparent that setting -webkit-perspective is only used with the flip transition. - Updated js/index.php, Makefile and build.xml to include the new jquery.mobile.transition.js file.
2011-04-26 21:06:10 +00:00
.viewport-flip {
-webkit-perspective: 1000;
-moz-perspective: 1000;
position: absolute;
}
.ui-mobile-viewport-transitioning,
.ui-mobile-viewport-transitioning .ui-page {
width: 100%;
height: 100%;
overflow: hidden;
}
.flip {
-webkit-animation-duration: .65s;
-webkit-backface-visibility:hidden;
-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. */
-moz-animation-duration: .65s;
-moz-backface-visibility:hidden;
-moz-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.out {
-webkit-transform: rotateY(-180deg) scale(.8);
-webkit-animation-name: flipouttoleft;
-moz-transform: rotateY(-180deg) scale(.8);
-moz-animation-name: flipouttoleft;
}
.flip.in {
opacity: 1;
z-index: 10;
2012-01-02 17:15:29 +00:00
-webkit-animation-duration: 300ms;
-webkit-animation-name: fadein;
2012-01-02 17:15:29 +00:00
-moz-animation-duration: 300ms;
-moz-animation-name: fadein;
}
/* Shake it all about */
.flip.out.reverse {
-webkit-transform: rotateY(180deg) scale(.8);
-webkit-animation-name: flipouttoright;
-moz-transform: rotateY(180deg) scale(.8);
-moz-animation-name: flipouttoright;
}
.flip.in.reverse {
opacity: 1;
z-index: 10;
2012-01-02 17:15:29 +00:00
-webkit-animation-duration: 300ms;
-webkit-animation-name: fadein;
2012-01-02 17:15:29 +00:00
-moz-animation-duration: 300ms;
-moz-animation-name: fadein;
}
/* for non-3d supporting browsers, use fade */
.ui-unsupported-csstransform3d .flip.out,
.ui-unsupported-csstransform3d .flip.out.reverse {
z-index: 0;
opacity: 0;
-webkit-animation-duration: 150ms;
-webkit-animation-name: fadeout;
-moz-animation-duration: 150ms;
-moz-animation-name: fadeout;
}
@-webkit-keyframes flipinfromright {
from { -webkit-transform: rotateY(-180deg) scale(.8); }
to { -webkit-transform: rotateY(0) scale(1); }
}
@-moz-keyframes flipinfromright {
from { -moz-transform: rotateY(-180deg) scale(.8); }
to { -moz-transform: rotateY(0) scale(1); }
}
@-webkit-keyframes flipinfromleft {
from { -webkit-transform: rotateY(180deg) scale(.8); }
to { -webkit-transform: rotateY(0) scale(1); }
}
@-moz-keyframes flipinfromleft {
from { -moz-transform: rotateY(180deg) scale(.8); }
to { -moz-transform: rotateY(0) scale(1); }
}
@-webkit-keyframes flipouttoleft {
from { -webkit-transform: rotateY(0) scale(1); }
to { -webkit-transform: rotateY(-180deg) scale(.8); }
}
@-moz-keyframes flipouttoleft {
from { -moz-transform: rotateY(0) scale(1); }
to { -moz-transform: rotateY(-180deg) scale(.8); }
}
@-webkit-keyframes flipouttoright {
from { -webkit-transform: rotateY(0) scale(1); }
to { -webkit-transform: rotateY(180deg) scale(.8); }
}
@-moz-keyframes flipouttoright {
from { -moz-transform: rotateY(0) scale(1); }
to { -moz-transform: rotateY(180deg) scale(.8); }
}
.pop {
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
}
.pop.in {
-webkit-transform: scale(1);
-moz-transform: scale(1);
opacity: 1;
-webkit-animation-name: popin;
-moz-animation-name: popin;
z-index: 10;
}
.pop.out {
z-index: 0;
-webkit-animation-name: fadeout;
-moz-animation-name: fadeout;
}
.pop.in.reverse {
z-index: 0;
-webkit-animation-name: fadein;
-moz-animation-name: fadein;
}
.pop.out.reverse {
-webkit-transform: scale(0);
-moz-transform: scale(0);
opacity: 0;
-webkit-animation-name: popout;
-moz-animation-name: popout;
z-index: 10;
}
@-webkit-keyframes popin {
from {
-webkit-transform: scale(0);
opacity: 0;
}
to {
-webkit-transform: scale(1);
opacity: 1;
}
}
@-moz-keyframes popin {
from {
-moz-transform: scale(0);
opacity: 0;
}
to {
-moz-transform: scale(1);
opacity: 1;
}
}
@-webkit-keyframes popout {
from {
-webkit-transform: scale(1);
opacity: 1;
}
to {
-webkit-transform: scale(0);
opacity: 0;
}
}
@-moz-keyframes popout {
from {
-moz-transform: scale(1);
opacity: 1;
}
to {
-moz-transform: scale(0);
opacity: 0;
}
}