Sha256: 0ac6a9d36c6c1c5e4bb14b1cb369f9525bafe71a4e0303c6ac45b15791cc8194

Contents?: true

Size: 1.62 KB

Versions: 9

Compression:

Stored size: 1.62 KB

Contents

;(function ($, window, document, undefined) {
  'use strict';

  Foundation.libs.accordion = {
    name : 'accordion',

    version : '5.2.2',

    settings : {
      active_class: 'active',
      multi_expand: false,
      toggleable: true
    },

    init : function (scope, method, options) {
      this.bindings(method, options);
    },

    events : function () {
      var self = this;
      var S = this.S;
      S(this.scope)
      .off('.fndtn.accordion')
      .on('click.fndtn.accordion', '[' + this.attr_name() + '] dd > a', function (e) {
        var accordion = S(this).closest('[' + self.attr_name() + ']'),
            target = S('#' + this.href.split('#')[1]),
            siblings = S('dd > .content', accordion),
            aunts = $('dd', accordion),
            settings = accordion.data(self.attr_name(true) + '-init'),
            active_content = S('dd > .content.' + settings.active_class, accordion),
            active_parent = S('dd.' + settings.active_class, accordion);
        e.preventDefault();

        if (! S(this).closest('dl').is(accordion)) { return; }

        if (settings.toggleable && target.is(active_content)) {
          active_parent.toggleClass(settings.active_class, false);
          return target.toggleClass(settings.active_class, false);
        }

        if (!settings.multi_expand) {
          siblings.removeClass(settings.active_class);
          aunts.removeClass(settings.active_class);
        }

        target.addClass(settings.active_class).parent().addClass(settings.active_class);
      });
    },

    off : function () {},

    reflow : function () {}
  };
}(jQuery, this, this.document));

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
woyo-server-0.0.9 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.8 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.7 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.6 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.5 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.4 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
woyo-server-0.0.2 public/server/foundation-5.2.2/js/foundation/foundation.accordion.js
zurb-foundation-5-5.2.2 js/foundation/foundation.accordion.js
foundation-rails-5.2.2.0 vendor/assets/javascripts/foundation/foundation.accordion.js