在这里您可以创建自己的转换Link1
如果您感到困惑,请创建自己的 js 函数然后打开 jquery.mobile.js 文件,看看它们对页面转换效果做了什么
$.mobile.transitionHandlers["slidefade"] = mycustomTransition;
function mycustomTransition( name, reverse, $to, $from ) {
var deferred = new $.Deferred();
// Define your custom animation here
$to.width("0");
$to.height("0");
$to.show();
$from.animate(
{ width: "0", height: "0", opacity: "0" },
{ duration: 750 },
{ easing: 'easein' }
);
$to.animate(
{ width: "100%", height: "100%", opacity: "1" },
{ duration: 750 },
{ easing: 'easein' }
);
// Standard template from jQuery Mobile JS file
reverseClass = reverse ? " reverse" : "";
viewportClass
= "ui-mobile-viewport-transitioning viewport-" + name;
$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.parent().addClass( viewportClass );
if ( $from ) {
$from.addClass( name + " out" + reverseClass );
}
$to.addClass( $.mobile.activePageClass + " " + name
+ " in" + reverseClass );
return deferred.promise();
}
你可以先在 Fiddle 上试试这里demo fiddle