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.
24 lines
556 B
24 lines
556 B
class app.views.Menu extends app.View
|
|
@el: '._menu'
|
|
@activeClass: 'active'
|
|
|
|
@events:
|
|
click: 'onClick'
|
|
|
|
init: ->
|
|
$.on document.body, 'click', @onGlobalClick
|
|
return
|
|
|
|
onClick: (event) ->
|
|
target = $.eventTarget(event)
|
|
target.blur() if 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
|