mobile safari - Framework7 starter page "pageInit" NOT WORKING -
anyone using framework7 create mobile website? found great , tried learn myself, meet problem, after create app, want on starter page initialization, here, starter page index.html, , set data-page="index", write below:
$$(document).on('pageinit', function (e) { var page = e.detail.page; // in browser console, no "index page" logged if (page.name === 'index') { console.log("index page"); }); // changed other page other index, works // browser logged "another page" if(page.name === 'login') { console.log('another page'); } });
anyone can help? thank much.
i have encountered same problem before.
pageinit event doesn't work initial page, pages navigate to, work index page if navigate other page , go index page.
so see 2 options here:
- just not use
pageinit
event index page - make initialization once (just make sure put javascript after html ready, or e.g. use jquery's on document ready event) - leave index page empty , load dynamically via framework7's
mainview.loadcontent
method,pageinit
event work (that option me had different index page each time, , loaded other pages dynamically underscore templates)
Comments
Post a Comment