Jquery Mobile问题,当我点击回来时向后滑动

时间:2013-07-22 07:09:59

标签: jquery-mobile hyperlink

我对a标记的数据转换存在很大问题。有时,当我点击某个标记时,它会转换为正确的转换back(right to left),但有时会转到from left to right。这是我的后退按钮(标签):

<a href="#account" data-direction="reverse" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-iconpos="notext" data-rel="back"></a>

HTML结构:

<!-- #account -->
<div data-role="page" id="account">
    <div data-role="panel" id="panel_menu" data-display="reveal"></div>
    <div data-role="header" data-position="fixed">
        <div class="ui-btn-left">
            <a href="#panel_menu" data-display="push" data-role="button" data-inline="true" data-icon="home" data-iconpos="notext"></a>
        </div>
        <h3>Account</h3>
        <div class="ui-btn-right">
            <a href="" id="logout" data-role="button" data-theme="r">Logout</a>
        </div>
    </div>
    <div data-role="content"></div>
</div>
<!-- #shop -->
<div data-role="page" id="shop">
    <div data-role="panel" id="panel_menu" data-display="reveal"></div>
    <div data-role="header" data-position="fixed">
        <div class="ui-btn-left">
            <a href="#panel_menu" data-display="push" data-role="button" data-inline="true" data-icon="home" data-iconpos="notext"></a>
            <a href="#account" data-direction="reverse" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-iconpos="notext" data-rel="back"></a>
        </div>
        <h3>Shop</h3>
    </div>
    <div data-role="content">
        <ul data-role="listview" data-inset="false" id="listview_shop"></ul>                
    </div>
</div>
<!-- #shop_details -->
<div data-role="page" id="shop_details">
    <div data-role="panel" id="panel_menu" data-display="reveal"></div>
    <div data-role="header" data-position="fixed">
        <div class="ui-btn-left">
            <a href="#panel_menu" data-display="push" data-role="button" data-inline="true" data-icon="home" data-iconpos="notext"></a>
            <a href="#shop" data-direction="reverse" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-iconpos="notext"></a>
        </div>
        <h3>Shop details</h3>
    </div>
    <div data-role="content"></div>
</div>

当我点击后退按钮上的shop_details时,它会以正确的方式滑动..但是当我点击后面的商店时,它会以错误的方式滑动..

提前感谢您的帮助

1 个答案:

答案 0 :(得分:1)

从此按钮中删除属性 data-rel="back"

<a href="#account" data-direction="reverse" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-iconpos="notext" data-rel="back"></a>

data-rel="back" 会返回上一页,在这种情况下,它会将您从页面购物返回到页面 shop_details

工作示例:http://jsfiddle.net/mdr3E/