1

リストビュー要素をクリックすると、 $.mobile.changePage を使用して新しいページに遷移します。

こんな感じで使っていますが、

$('ul').children('li').on('click', function () {
 created_date = $.trim($(this).text());
 $.mobile.changePage( "Image.html", {
  transition: 'slide',
  reverse: 'true'
 });                    
});

これはhtmlページです

<div data-role="page" id="SavedImage" >
 <div data-role="header">
  <h1></h1>
  <a href="#"></a>
 </div>
 <div data-role="content">
  <img src="Image/InScope.png" alt="" style="height:100%; width:100%;" />
 </div>
 <div data-role="footer">
 </div>
</div>

に遷移しimage.html、戻るボタンをクリックすると に移動する必要があります。しかし、ページlistviewに遷移しlistview、再び image.html ページに戻ります。

に戻らないようにする方法image.html

4

2 に答える 2

1

私はあなたのコードの残りを見ることができませんが、私はあなたの問題を理解していると思います. 私の推測が正しければ、あなたの問題は簡単に解決できます。

最初はうまく機能しますが、毎回あなたが説明した問題があると思います。

クリック バインディング コードを次のように変更します。

$('ul').children('li').off('click').on('click', function () { 
    created_date = $.trim($(this).text());

    $.mobile.changePage( "Image.html", {
                        transition: 'slide',
                        reverse: 'true'
    });
});

基本的に、リスト ページに戻るたびにクリック イベントが再度バインドされます。各バインドで li 要素をクリックすると、いくつかの changePage イベントがトリガーされ、問題が発生します。

于 2013-05-17T07:45:31.987 に答える