app/assets/javascripts/partystreusel/accordion.js.coffee in partystreusel-1.1.0pre2 vs app/assets/javascripts/partystreusel/accordion.js.coffee in partystreusel-1.1.0
- old
+ new
@@ -12,11 +12,16 @@
toggleItem: (e) =>
item = $(e.target).closest('.accordion__item')
currentOpen = item.hasClass('accordion__item--open')
+ @items.filter('.accordion__item--open').each (_, i) =>
+ @trigger('close', $(i))
+
@items.removeClass('accordion__item--open')
- item.toggleClass('accordion__item--open') unless currentOpen
+ unless currentOpen
+ item.toggleClass('accordion__item--open')
+ @trigger('open', item)
e.preventDefault()
Partystreusel.scrollTo(item, @offset)
Partystreusel.Accordion = Accordion