?
要创建一个自定义的CSS过渡,选择一个类名对应的名字你的过渡,例如“幻灯片”,然后定义 转入和转出,利用转换或动画关键帧的CSS规则:
.slide.in {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-webkit-animation-name: slideinfromright;
-moz-animation-name: slideinfromright;
}
.slide.out {
-webkit-transform: translateX(-100%);
-moz-transform: translateX(-100%);
-webkit-animation-name: slideouttoleft;
-moz-animation-name: slideouttoleft;
}
@-webkit-keyframes slideinfromright {
from { -webkit-transform: translateX(100%); }
to { -webkit-transform: translateX(0); }
}
@-webkit-keyframes slideouttoleft {
from { -webkit-transform: translateX(0); }
to { -webkit-transform: translateX(-100%); }
}
@-moz-keyframes slideinfromright {
from { -moz-transform: translateX(100%); }
to { -moz-transform: translateX(0); }
}
@-moz-keyframes slideouttoleft {
from { -moz-transform: translateX(0); }
to { -moz-transform: translateX(-100%); }
}
---------------------------
如果你的转换支持相反的方向,你需要创建CSS规则,使用反向
类除了过渡类名称
.slide.in.reverse {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-webkit-animation-name: slideinfromleft;
-moz-animation-name: slideinfromleft;
}
.slide.out.reverse {
-webkit-transform: translateX(100%);
-moz-transform: translateX(100%);
-webkit-animation-name: slideouttoright;
-moz-animation-name: slideouttoright;
}
@-webkit-keyframes slideinfromleft {
from { -webkit-transform: translateX(-100%); }
to { -webkit-transform: translateX(0); }
}
@-webkit-keyframes slideouttoright {
from { -webkit-transform: translateX(0); }
to { -webkit-transform: translateX(100%); }
}
@-moz-keyframes slideinfromleft {
from { -moz-transform: translateX(-100%); }
to { -moz-transform: translateX(0); }
}
@-moz-keyframes slideouttoright {
from { -moz-transform: translateX(0); }
to { -moz-transform: translateX(100%); }
}
----------------------
指定名称的过渡在@数据化属性的导航链接
<a href="#page2" data-transition="slide">Page 2</a>
-----------------------
.in {
-webkit-animation-timing-function: ease-out;
-webkit-animation-duration: 350ms;
-moz-animation-timing-function: ease-out;
-moz-animation-duration: 350ms;
}
.out {
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 225ms;
-moz-animation-timing-function: ease-in;
-moz-animation-duration: 225;
}
-----------------------------------------------
jQuery Mobile的CSS定义了默认的宽松和持续时间在以下规则
.in {
-webkit-animation-timing-function: ease-out;
-webkit-animation-duration: 350ms;
-moz-animation-timing-function: ease-out;
-moz-animation-duration: 350ms;
}
.out {
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 225ms;
-moz-animation-timing-function: ease-in;
-moz-animation-duration: 225;
}
---------------------------------------
?