diff options
Diffstat (limited to 'studio-susie/public/assets/js/lib/nav/DesktopNav.js')
| -rw-r--r-- | studio-susie/public/assets/js/lib/nav/DesktopNav.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/studio-susie/public/assets/js/lib/nav/DesktopNav.js b/studio-susie/public/assets/js/lib/nav/DesktopNav.js new file mode 100644 index 0000000..5d00c23 --- /dev/null +++ b/studio-susie/public/assets/js/lib/nav/DesktopNav.js @@ -0,0 +1,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') + } + }, + +}); |
