相关疑难解决方法(0)

jQuery Mobile pageinit/pagecreate没有触发

我有5页 - 为了方便我们说:

  • one.html
  • two.html
  • three.html
  • four.html
  • five.html

当我打开每一个单独页面,都pageinit和pagecreate正确射击.

问题:

当我从one.html转到two.html,pageinit并且pagecreate两个都开火,但是当我回到one.html(来自two.html),pageinit并且pagecreate不要开火.

为什么这样,我怎么能一直开火pageinit和pagecreate页面加载,以及浏览每个页面?

更新:

对于我拥有的每个页面:

<div data-role="page" id="page-name">

 // content
</div>
Run Code Online (Sandbox Code Playgroud)

为了测试事情发生时的顺序我做:

$(document).on('pagecreate','[data-role=page]', function(){
  console.log('PAGECREATE');
});
$(document).on('pageinit','[data-role=page]', function(){
  console.log('PAGEINIT');
});
$(document).on('pagebeforeshow','[data-role=page]', function(){
  console.log('PAGEBEFORESHOW');
});
$(document).on('pageshow','[data-role=page]', function(){
  console.log('PAGESHOW');
});
Run Code Online (Sandbox Code Playgroud)

如何使用pagechange始终调用pageinit和pagecreate

jquery jquery-mobile

18
推荐指数
1
解决办法
3万
查看次数

标签 统计

jquery ×1

jquery-mobile ×1