Sha256: 7b718d701c04f640b03e06603620ef8d44a07d6cb32ec5a4e56e84da8d69ae66

Contents?: true

Size: 818 Bytes

Versions: 3

Compression:

Stored size: 818 Bytes

Contents

$(document).on 'click', 'nav#primary a.back-to-main-menu', (e) ->
  $('nav#primary').addClass('animated')
  $('nav#primary').removeClass('transformed')
  e.preventDefault()

$(document).on 'click', 'nav#primary:not(.transformed) > ul > li > a', (e) ->
  if $(this).parent().find('ul').length > 0
    e.preventDefault()

    $(this).parent().siblings().removeClass('active')
    $(this).parent().addClass('active')

# Clicking something from the primary menu adds the animation
$(document).on 'click', 'nav#primary:not(.transformed) > ul > li > a', (e) ->
  $('nav#primary').addClass('animated').addClass('transformed')

# Clicking directly on the primary menu when it's transformed removes the animation
$(document).on 'click', 'nav#primary.transformed > ul > li > a', (e) ->
  $('nav#primary').removeClass('animated')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spina-template-0.4.2 app/assets/javascripts/spina/navigation.coffee
spina-template-0.4.1 app/assets/javascripts/spina/navigation.coffee
spina-template-0.4.0 app/assets/javascripts/spina/navigation.coffee