JQM (jQueryMobile) Push last page out of DOM on changePage()

前端 未结 2 1497
走了就别回头了
走了就别回头了 2021-01-18 04:53

I notice that the page that I was just viewing is still in the DOM. Is there a way to remove the last page viewed after I transition to the new page using changePage()?

2条回答
  •  逝去的感伤
    2021-01-18 05:42

    Not exactly knowing your markup I am guessing you are triggering changePage() manually. If that is the case, you could wire up one of the events listed here.

    pageshow
    Triggered on the page being shown, after its transition completes.

    $('div').live('pageshow',function(event, ui){
      $(ui.prevPage).remove();
    });
    

    Example on jsfiddle.

提交回复
热议问题