JQM(jQueryMobile)将最后一页推送到changePage()上的DOM中 [英] JQM (jQueryMobile) Push last page out of DOM on changePage()

查看:100
本文介绍了JQM(jQueryMobile)将最后一页推送到changePage()上的DOM中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我刚刚查看的页面仍然在DOM中。有没有办法删除在使用changePage()转换到新页面后查看的最后一页?

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()?

我已经禁用了所有的后退导航,因为我不想用于在转换到新页面时返回最后一页。

I have disabled all the back navigation as I don't want the use to go back to the last page when transitioning to the new page(s).

任何建议?

网站流量


  • 主页 - >填写info-> submit on changePage()

  • 下一页 - >填写更多信息 - >提交changePage()

  • 等...

一旦页面被提交,我就不再需要了。

Once the page has been submitted I don't need it anymore

更新:

这是第一页:

<div data-role="page" 
     id="first_page" 
     data-theme="z" 
     data-backbtn="false" 
     data-url="first_page" 
     class="ui-page 
     ui-body-z">

添加新页面时会附加一些内容:

It appends something to this when adding a new page:

<div data-role="page" 
     id="next_page" 
     name="next_page" 
     data-theme="z" 
     data-title="next_page" 
     data-url="getNextPage.php?page=next_page" 
     class="ui-page 
     ui-body-z">

这样调用live():

Calling the live() like this:

// pageName[index] = next_page
$('#'+pageName[index]).live('pagecreate',function(event, ui){   
    $(ui.prevPage).remove();

使用changePage() / p>

using changePage() like this:

$.mobile.changePage('getNextPage.php?page='+pageName[index],'slide',false,false);


推荐答案

不完全知道你的标记我猜你正在触发 changePage(),如果是这样,您可以连接列出的一个事件 here

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

在转换完成后,页面上显示

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



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

jsfiddle上的示例

这篇关于JQM(jQueryMobile)将最后一页推送到changePage()上的DOM中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆