Sha256: 28e92dd997847d1b5ffb68e99fc165b2591a15faf806477ab184d736423f83ed

Contents?: true

Size: 551 Bytes

Versions: 5

Compression:

Stored size: 551 Bytes

Contents

#= require partystreusel/base

class Topbar extends Partystreusel.Base
  @className = 'Topbar'

  constructor: (el) ->
    super
    @$el.find('.topbar__mobile-menu').on 'click', @toggle
    @$el.find('.topbar__item').on 'click', @toggleItem

  toggle: (e) =>
    @$el.toggleClass('topbar--open')

  toggleItem: (e) =>
    item = $(e.target).closest('.topbar__item')
    subList = item.find('.topbar__sub-list')
    return if subList.length == 0

    subList.toggleClass('topbar__sub-list--open')
    e.preventDefault()

Partystreusel.Topbar = Topbar

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
partystreusel-2.0.0 app/assets/javascripts/partystreusel/topbar.js.coffee
partystreusel-1.2.0 app/assets/javascripts/partystreusel/topbar.js.coffee
partystreusel-1.1.1 app/assets/javascripts/partystreusel/topbar.js.coffee
partystreusel-1.1.0 app/assets/javascripts/partystreusel/topbar.js.coffee
partystreusel-1.1.0pre2 app/assets/javascripts/partystreusel/topbar.js.coffee