I use Ratchet. My phonegap app has two pages, containing jquery.js, ratchet.js, and blockui.js (jQuery-based).
index.html:
<script>$.blockUi()</script>
<a href="2.html" data-transition="slide-in">2.html</a>
2.html:
<a href="index.html" data-transition="slide-out">index.html</a>
at first $.blockUi()
runs correctly. then I press the link at the first page. After I press the link on the second page, no JavaScript runs. What should I do?
From the docs on Github:
Script tags containing JavaScript will not be executed on pages that are loaded with push.js. If you would like to attach event handlers to elements on other pages, document-level event delegation is a common solution.
From the docs site
Push.js binds an event to the document that returns a detail object and can be used to fire a callback.
Therefore I believe you would have to use this event listener to get your scripts to run:
window.addEventListener('push', myFunction);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With