0
当我加载我的主干网页并按下后退按钮时,它会将/#添加到url中。如果我再次点击,它会从rails home视图加载空索引页面。我可以通过关闭turbolink来解决这个问题。如何在关闭对话框时禁用backbone.js添加/#
但是,当我打开任何的foundation.js对话框时,它也会将相同的/#追加到url。现在,当我回到上一页时,它再次加载空导轨主页,而不是加载骨干网页。
如何防止骨干添加这个/#哈希。
我的轨道索引页:
<div class="containing_div"><div>
<%= javascript_tag do -%>
(function() {
MyApp.initialize();
})();
<% end -%>
我的初始化函数是:
initialize: function(){
this.private.biography = new MyApp.Models.BiographyModel();
this.private.purposeModel = new MyApp.Models.PurposeModel();
new MyApp.Routers.Welcome();
if(!Backbone.History.started){
Backbone.history.start();
}
this.initializeData();
}
而且我的路由器是:
MyApp.Routers.Welcome = Support.SwappingRouter.extend({
initialize: function(options){
this.el = $('div.containing_div');
},
routes: {
"": "index"
},
index: function(){
var view = new MyApp.Views.WelcomeIndex();
this.swap(view);
}
})
这就是我如何关闭我的模态:
$('#profileModal').foundation('reveal', 'close', {
animation: 'none'
});
谢谢。现在我已经能够通过使用e.preventDefault()来解决这个问题。但我想知道是否有更好的方式(更主要的方式)来实现这一点。考虑到骨干网非常流行,我可以使用谷歌搜索找到任何解决方案。 – user1801879