Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ratchet.js和window.history.back();_Javascript_Jquery_Ratchet 2 - Fatal编程技术网

Javascript Ratchet.js和window.history.back();

Javascript Ratchet.js和window.history.back();,javascript,jquery,ratchet-2,Javascript,Jquery,Ratchet 2,我有一个init函数,我的所有jQuery工作人员都在文档就绪状态下执行,并有一个推送事件侦听器: function init() { //all my jquery staff } window.addEventListener('push', init); $(document).ready(function() { init(); }); 在通过推送加载的页面上,我在页眉上有一个反向链接。请注意back类 <header class="bar bar-nav">

我有一个init函数,我的所有jQuery工作人员都在文档就绪状态下执行,并有一个推送事件侦听器:

function init() {
    //all my jquery staff
}
window.addEventListener('push', init);
$(document).ready(function() {
    init();
});
在通过推送加载的页面上,我在页眉上有一个反向链接。请注意back

<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>
而且效果很好。然而,回去后,我的其他jquery员工都不工作。

我尝试过PopStateChange,但我的一些jquery执行了不止一次

window.onpopstate = function(event) {
  init();
}
关于如何在ratchet.js上实现back按钮有什么想法吗?


谢谢

请编辑您的答案,并解释为什么这是一个好的解决方案。
window.onpopstate = function(event) {
  init();
}
PUSH({ url: href,  transition: "slide-out" })