Sha256: d00f9a4747afadd7c52082dc409f0b6dd6f64e257cf9ccd46c24b6e19288c610

Contents?: true

Size: 1.84 KB

Versions: 39

Compression:

Stored size: 1.84 KB

Contents

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

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

    version : '5.2.3',

    settings : {
      active_class: 'active',
      multi_expand: false,
      toggleable: true,
      callback : function () {}
    },

    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),
            groupSelector = self.attr_name() + '=' + accordion.attr(self.attr_name()),
            settings = accordion.data(self.attr_name(true) + '-init'),
            active_content = S('dd > .content.' + settings.active_class, accordion);
        e.preventDefault();

        if (accordion.attr(self.attr_name())) {
          siblings = siblings.add('[' + groupSelector + '] dd > .content');
          aunts = aunts.add('[' + groupSelector + '] dd');
        }

        if (settings.toggleable && target.is(active_content)) {
          target.parent('dd').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);
        settings.callback(target);
      });
    },

    off : function () {},

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

Version data entries

39 entries across 39 versions & 4 rubygems

Version Path
rubyneat_dashboard-0.4.1 bower_components/foundation/js/foundation/foundation.accordion.js
locomotivecms_wagon-2.2.0.beta1 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.1.1 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.1.0 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.1.0.rc5 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.1.0.rc4 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.1.0.rc3 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.1 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc8 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc7 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc6 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc5 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc4 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc3 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc2 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.rc1 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.pre.beta.2 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-1.5.8 generators/foundation5/public/javascripts/foundation/foundation.accordion.js
locomotivecms_wagon-2.0.0.pre.beta.1 generators/foundation5/public/javascripts/foundation/foundation.accordion.js