JQuery Mobile: data-direction=“reverse” not emulating initial transition

做~自己de王妃 提交于 2019-12-11 01:15:11

问题


I have a back button in my header that looks like:

<a href="index.html" data-role="button" data-direction="reverse"
data-icon="arrow-l" data-iconpos="left">Back</a>

The transition to get to this page is slide and, according to the documentation, adding data-direction="reverse" to my back button should 'reverse' the transition that got me to that page, ie: the previous page should slide back. However, this seems to be stuck just on the default fade transition. Is there something I have done wrong in setting this button up? Should I have a different kind of href?


回答1:


Try adding this:

data-rel="back"

<a href="/" data-icon="back" data-rel="back" data-direction="reverse">Back</a>

Also I think in order for "reverse" to work you must reference the exact previous URL/page. So if your page1 is "/" then you went to page2 and on page2 you have href="index.html" it won't work.




回答2:


What you can also do is declare the transition, so the reverse will work

<a href="index.htm" data-role="button" data-direction="reverse" data-transition="slide">Cancel</a>

In my case, this link is 2 pages after, so data-rel="back" was not what I was looking for



来源:https://stackoverflow.com/questions/16535296/jquery-mobile-data-direction-reverse-not-emulating-initial-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!