Sha256: 8e5ccc5ae691a02aad2caadf0e0343ee1d4f1b94d4c99914eebcb627ef67e95d

Contents?: true

Size: 1.49 KB

Versions: 41

Compression:

Stored size: 1.49 KB

Contents

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

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

    version : '5.1.1',

    settings : {
      active_class: 'active',
      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 (active_content[0] == target[0] && settings.toggleable) {
          active_parent.toggleClass(settings.active_class, false);
          return target.toggleClass(settings.active_class, false);
        }

        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

41 entries across 41 versions & 2 rubygems

Version Path
opsask-2.1.4 public/js/foundation/foundation.accordion.js
opsask-2.1.3 public/js/foundation/foundation.accordion.js
opsask-2.1.2 public/js/foundation/foundation.accordion.js
opsask-2.1.1 public/js/foundation/foundation.accordion.js
opsask-2.1.0 public/js/foundation/foundation.accordion.js
opsask-2.0.14 public/js/foundation/foundation.accordion.js
opsask-2.0.13 public/js/foundation/foundation.accordion.js
opsask-2.0.12 public/js/foundation/foundation.accordion.js
opsask-2.0.11 public/js/foundation/foundation.accordion.js
opsask-2.0.10 public/js/foundation/foundation.accordion.js
opsask-2.0.9 public/js/foundation/foundation.accordion.js
opsask-2.0.8 public/js/foundation/foundation.accordion.js
opsask-2.0.7 public/js/foundation/foundation.accordion.js
opsask-2.0.6 public/js/foundation/foundation.accordion.js
opsask-2.0.5 public/js/foundation/foundation.accordion.js
opsask-2.0.4 public/js/foundation/foundation.accordion.js
opsask-2.0.3 public/js/foundation/foundation.accordion.js
opsask-2.0.2 public/js/foundation/foundation.accordion.js
opsask-2.0.1 public/js/foundation/foundation.accordion.js
opsask-2.0.0 public/js/foundation/foundation.accordion.js