Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for multiple accordion containers #4

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions jquery.accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
}

//hides a accordion panel
function close(opts) {
opened = $(document).find('.' + opts.cssOpen);
function close($this, opts) {
opened = $this.parent().find('.' + opt.cssOpen);
$.each(opened, function() {
//give the proper class to the linked element
$(this).addClass(opts.cssClose).removeClass(opts.cssOpen);
Expand All @@ -136,7 +136,7 @@

//opens a accordion panel
function open($this, opts) {
close(opts);
close($this, opts);
//give the proper class to the linked element
$this.removeClass(opts.cssClose).addClass(opts.cssOpen);

Expand All @@ -156,15 +156,15 @@
// close the only open item
if ($this.hasClass(opts.cssOpen))
{
close(opts);
close($this, opts);
//do cookies if plugin available
if (useCookies(opts)) {
// split the cookieOpen string by ","
setCookie('', opts);
}
return false;
}
close(opts);
close($this, opts);
//open a closed element
open($this, opts);
return false;
Expand Down Expand Up @@ -260,4 +260,4 @@
elem.next().hide();
}
};
})(jQuery);
})(jQuery);