sliding left to right transition in jQuery Mobile

2019-03-30 23:32发布

I'm adding pages run time when swipeleft is happened. But when swiperight happened I can't return the previous page that I'm created with sliding from left to right.

I have added the data-direction="reverse" to the pages but it didn't create left-to-right effect.

Is there any way to do this?

5条回答
Viruses.
2楼-- · 2019-03-30 23:56

By using data-rel="back" jQuery Mobile will mimic the back button, see "Back linking" here: http://jquerymobile.com/demos/1.0b1/#/demos/1.0b1/docs/pages/docs-pages.html

查看更多
▲ chillily
3楼-- · 2019-03-31 00:06

A maybe easier way using JQM would be:

<a href="page.html" data-transition="slide" data-direction="reverse">Link Text</a> 

or also, within js as:

$.mobile.changePage("page.html", { transition: 'slide', reverse: true });
查看更多
淡お忘
4楼-- · 2019-03-31 00:06
function ChangePage(pageId,iPageIndex) {
    var forward = iCurrCardIndex < iPageIndex;
    iCurrCardIndex = iPageIndex;

    $.mobile.changePage("#" + pageId, "slide", !forward, true);
}
查看更多
SAY GOODBYE
5楼-- · 2019-03-31 00:09
<a href="nextPage.html" data-transition="reverse slide">Next page</a>
查看更多
别忘想泡老子
6楼-- · 2019-03-31 00:13

data-direction="reverse" does not belong on the page, you add it to the link:

<a href="page.html" data-direction="reverse">Link Text</a> 

will send you to page.html with a reverse transition.

查看更多
登录 后发表回答