summaryrefslogtreecommitdiff
path: root/new-reality/public/assets/js/lib/nav/MobileNav.js
blob: aec70904dc2e5d1927e09f5e782131df2db57cdf (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
var MobileNav = View.extend({

  el: '#mobile_nav',

  events: {
    'touchstart .logo': 'home',
    'touchstart .hamburger': 'hamburger'
  },

  initialize: function(options){
    options = options || {}
    this.state = {
      open: false
    }
  },

  home: function (){
    app.nav.home()
  },

  hamburger: function (e){
    $('html').toggleClass('navopen')
    app.mobile_nav.state.open = ! app.mobile_nav.state.open
    if (app.mobile_nav.state.open) {
      $(".page-set").on("click", app.mobile_nav.hamburger)
    }
    else {
      $(".page-set").off("click", app.mobile_nav.hamburger)
    }
  },
  
})