mirror of
https://github.com/AlekseyLobanov/AlekseyLobanov.github.io.git
synced 2026-01-12 05:02:02 +03:00
First commut
This commit is contained in:
41
theme/js/foundation/foundation.accordion.js
vendored
Normal file
41
theme/js/foundation/foundation.accordion.js
vendored
Normal file
@@ -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));
|
||||
Reference in New Issue
Block a user