Backbone.js的。深入链接到页面部分

时间:2015-02-03 09:46:51

标签: javascript backbone.js

我在Backbone.js中开发应用程序。每个页面/视图包含堆叠的不同部分,因此滚动很长。我希望能够通过某种方式使用路由器深层链接它们。因此页面滚动到正确的部分。

我的路由器看起来像这样:

Router = Backbone.Router.extend({
routes: {
    'chapter-1': 'one',
    'chapter-2': 'two'
},

one: function() {
    new HomeView({el:'#main-view'});
},

two: function() {
    new PurityView({el:'#main-view'});
}

});

现在假设我希望能够链接到one / some-section-id

例如:

<section id="some-section-id">
    content
</section>
<section id="another-section-id">
    content
</section>

我该怎么做?

0 个答案:

没有答案