Sha256: 7ed745b6eec62d56e7a3bf3277af1dff0b72de646f258a3607bbfdfe1fd343f1

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

#= require partystreusel/base

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

  constructor: (el) ->
    super
    @$el.find('.js-offcanvas__toggler').on 'click', @toggle
    @$el.find('.offcanvas__overlay').on 'click', @toggle
    @$el.find('.offcanvas-nav__link').on 'click', @toggleNavLink

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

  toggleNavLink: (e) =>
    navLink = $(e.target).closest('.offcanvas-nav__link')
    subNav = navLink.next('.offcanvas-nav__sub')
    return if subNav.length == 0
    e.preventDefault()
    subNav.toggleClass('offcanvas-nav__sub--open')

Partystreusel.Offcanvas = Offcanvas

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
partystreusel-1.1.0pre2 app/assets/javascripts/partystreusel/offcanvas.js.coffee
partystreusel-1.1.0pre1 app/assets/javascripts/partystreusel/offcanvas.js.coffee