1

所以我想要实现的是,在手动创建页面更改时应用任何页面转换。

例如,在我的网页上说,我这样做是为了当用户向右滑动时,网站会转到第二页....就像这样

$('#firstPage').bind("swiperight", function(){
            //alert("swiped right on the body element");
            $.mobile.changePage('#secondPage'); 

        });

现在我想为这个函数附加一个页面转换。如果它在一个实际的链接上,那么一个人会应用一个data-transition,但由于这个页面更改是手动创建的,我想知道如何向它附加一个过渡。

我试过例如

    $('#firstPage').bind("swiperight", function(){
        //alert("swiped right on the body element");
        $.mobile.changePage('#secondPage','flip');  

    });

等但无济于事,任何想法我将如何实施?提前致谢。

4

2 回答 2

1

尝试替换bindon

$('#firstPage').on("swiperight", function(){
        //alert("swiped right on the body element");
        $.mobile.changePage('#secondPage','flip');  
 });

我有类似的问题,这对我有用。

于 2012-08-21T03:19:19.773 回答
1

你几乎明白了,你只需要在{}括号内声明函数的第二个参数(你的选项):

$('#firstPage').bind("swiperight", function(){

    //alert("swiped right on the body element");
    $.mobile.changePage( "#secondPage", { transition: "flip"} );

});
于 2012-08-21T23:11:10.720 回答