I have a mobile site, where the pages all include a script js file, all the pages are separate but preloaded into the dom cache.I have a mobile site, where the pages all include a script js file, all the pages are separate but preloaded into the dom cache.
When i can the hen i can the:
$(document).live('pageinit',function() { console.log('test') }
I get about 15 messages due to there being about 15 pages preloaded from the start page.
is there an appropriate alternative event that will only fire when the page is actually brought into the active state?
or another solution to this issue?
EDIT: Additional Info:
I am using a php framework to serve the pages and each page is templated to include the same script.js file, this script file simplhy controlls thing a the navigation accordion and dynamic page changes, however it fires onece for each of the preloaded pages.
It depends on how you would like to structure your pages. I don’t know what’s the intention behind having 15 different pages with their own logic. I see 2 different ways
pageinitevent and handles all of its “child” pages which are just containers for the displayed (jquery mobile) HTMLpageiniton each page which does just the initialization of its own context, i.e. the page it is inside. This might become tricky as I’m not sure you’re able to always clearly identify the context yourpageinitis currently running in.I’m not sure that on whether I was able to help you. You’d have to explain more in detail on what’s the intention behind having 15 different
pageinits on each page.