Ratchet push.js with telephone (cordova)

I am using Ratchet. My phonegap application has two pages containing jquery.js, ratchet.js and blockui.js (based on jQuery).

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> 

$.blockUi() executes correctly. then I click the link on the first page. After I click the link on the second page, JavaScript does not start. What should I do?

+6
source share
1 answer

From docs to github:

Tags

Scripts containing JavaScript will not be executed on pages loaded by push.js. If you want to attach event handlers to elements on other pages, delegating events at the document level is a common solution.

From the docs website

Push.js associates an event with a document that returns a part object and can be used to trigger a callback.

Therefore, I believe that you will need to use this event listener to run your scripts: window.addEventListener('push', myFunction);

+2
source

All Articles