jQuery Mobile - 清除所有页面并添加新页面

时间:2014-11-22 02:31:00

标签: javascript jquery jquery-mobile

我正在动态生成页面并将它们添加到页面容器中(此部分可用)。

我希望能够清除所有页面(清空数组)并重新添加新的动态生成的页面列表。

我试过了:

    $(document).find('div[data-role="page"]').remove();
    $.mobile.pageContainer.empty();

这两个调用都会从DOM中删除页面,我可以重新添加新页面,但是当我尝试调用时:

jQ.mobile.changePage(page1);

我收到以下错误:

Uncaught TypeError: Cannot read property '_trigger' of undefined 

在线上(在jQuery mobile中):

fromPage.data( "mobile-page" )._trigger( "beforehide", null, { nextPage: toPage } );

感谢任何帮助。

0 个答案:

没有答案