aboutsummaryrefslogtreecommitdiffstats
path: root/zurb-F5-basic/static/js/foundation/foundation.accordion.js
diff options
context:
space:
mode:
Diffstat (limited to 'zurb-F5-basic/static/js/foundation/foundation.accordion.js')
-rw-r--r--zurb-F5-basic/static/js/foundation/foundation.accordion.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/zurb-F5-basic/static/js/foundation/foundation.accordion.js b/zurb-F5-basic/static/js/foundation/foundation.accordion.js
new file mode 100644
index 0000000..c36d0b1
--- /dev/null
+++ b/zurb-F5-basic/static/js/foundation/foundation.accordion.js
@@ -0,0 +1,41 @@
+;(function ($, window, document, undefined) {
+ 'use strict';
+
+ Foundation.libs.accordion = {
+ name : 'accordion',
+
+ version : '5.0.1',
+
+ settings : {
+ active_class: 'active',
+ toggleable: true
+ },
+
+ init : function (scope, method, options) {
+ this.bindings(method, options);
+ },
+
+ events : function () {
+ $(this.scope).off('.accordion').on('click.fndtn.accordion', '[data-accordion] > dd > a', function (e) {
+ var accordion = $(this).parent(),
+ target = $('#' + this.href.split('#')[1]),
+ siblings = $('> dd > .content', target.closest('[data-accordion]')),
+ settings = accordion.parent().data('accordion-init'),
+ active = $('> dd > .content.' + settings.active_class, accordion.parent());
+
+ e.preventDefault();
+
+ if (active[0] == target[0] && settings.toggleable) {
+ return target.toggleClass(settings.active_class);
+ }
+
+ siblings.removeClass(settings.active_class);
+ target.addClass(settings.active_class);
+ });
+ },
+
+ off : function () {},
+
+ reflow : function () {}
+ };
+}(jQuery, this, this.document));