I have an init function with all my jQuery staff that I execute on document ready and with a push event listener:
function init() {
//all my jquery staff
}
window.addEventListener('push', init);
$(document).ready(function() {
init();
});
On a page loaded via push I have a back link on the header. Notice the back class.
<header class="bar bar-nav">
<a class="icon icon-left-nav pull-left back" data-transition="slide-out"></a>
<h1 class="title">My Title</h1>
</header>
To go back I use
$('.back').click(function (event) {
window.history.back();
return false;
});
And it works great. However, after going back, none of my other jquery staff works.
I have try onpopstatechange but some of my jquery executes more than once
window.onpopstate = function(event) {
init();
}
Any ideas on how to implement the back button on ratchet.js?
Thanks