blob: 5d00c23c6b1c78755628da3a85e2a2b8de5f57a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
var NavView = View.extend({
el: "#mobile-nav",
events: {
"click .pages a": "go",
},
initialize: function(){
},
home: function(){
app.router.go("/")
this.$headings.find(".active").removeClass("active")
if (app.mobile_nav && app.mobile_nav.state.open) {
app.mobile_nav.hamburger()
}
},
go: function(e){
e.preventDefault()
var href = $(e.currentTarget).attr("href")
app.router.go(href)
console.log(href)
if (is_mobile) {
app.mobile_nav.hamburger()
}
this.after_go()
},
after_go: function(){
},
setActive: function(id){
var href = '/' + id
var $el = $('[href="' + href + '"]')
this.$('.active').removeClass('active')
if ($el.length) {
$el.addClass('active')
}
},
});
|