Sha256: 0ec0f8ef9a6b0a34b2e570a516238c7830888ddc15a182c45d930b62b1702ebf

Contents?: true

Size: 672 Bytes

Versions: 50

Compression:

Stored size: 672 Bytes

Contents

$(document).ready ->

  $(".js-accordion-trigger").each (index, element) ->
    target = $(this).data("target")

    # Init
    if $(target).is(":visible")
      $(this).text($(this).attr("data-text-close"))
      $(this).addClass "is-open"
    else
      $(this).text($(this).attr("data-text-open"))

    $(this).bind "click focus", ->
      target = $(this).data("target")
      $(target).slideToggle "fast"
      $(target).toggleClass "is-open"
      $(this).toggleClass "is-open"

      if $(target).hasClass("is-open")
        $(this).text($(this).attr("data-text-open"))
      else
        $(this).text($(this).attr("data-text-close"))

      event.preventDefault()

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
wrgem-0.0.11 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.10 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.9 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.8 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.7 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.6 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.4 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.3 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.2 lib/generators/wrstart/template/javascripts/components/_accordion.coffee
wrgem-0.0.1 lib/generators/wrstart/template/javascripts/components/_accordion.coffee