jQuery移动数据转换

时间:2011-07-06 14:09:00

标签: javascript jquery mobile

在jQuery mobile中,页面过渡效果是通过设置数据转换属性,即滑动滑动等来实现的。

有没有办法使用JavaScript调用效果?

完整的API在哪里?

提前多多感谢。

1 个答案:

答案 0 :(得分:1)

试试这个:

// Define your transition handler:

function myTransitionHandler(name, reverse, $to, $from)
{
    var deferred = new $.Deferred();

    // Perform any actions or set-up necessary to kick-off
    // your transition here. The only requirement is that
    // whenever the transition completes, your code calls
    // deferred.resolve(name, reverse, $to, $from).

    // Return a promise.
    return deferred.promise();
}

// Register it with jQuery Mobile:

$.mobile.transitionHandlers["myTransition"] = myTransitionHandler;

HTML:

<a href="#page2" data-transition="myTransition">Page 2</a>

here for more examples and transitions

编辑以下是一些API: