mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
534 B
23 lines
534 B
class app.views.Menu extends app.View
|
|
@el: '._menu'
|
|
@activeClass: 'active'
|
|
|
|
@events:
|
|
click: 'onClick'
|
|
|
|
init: ->
|
|
$.on document.body, 'click', @onGlobalClick
|
|
return
|
|
|
|
onClick: (event) ->
|
|
event.target.blur() if event.target.tagName is 'A'
|
|
return
|
|
|
|
onGlobalClick: (event) =>
|
|
return if event.which isnt 1
|
|
if event.target.hasAttribute?('data-toggle-menu')
|
|
@toggleClass @constructor.activeClass
|
|
else if @hasClass @constructor.activeClass
|
|
@removeClass @constructor.activeClass
|
|
return
|