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:

  1. 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)
  2. 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

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -