aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.accordion.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/ui.accordion.js')
-rw-r--r--ui/ui.accordion.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js
index 5fb6b501a..de1a29f1e 100644
--- a/ui/ui.accordion.js
+++ b/ui/ui.accordion.js
@@ -27,18 +27,6 @@ $.widget("ui.accordion", {
o.collapsible = !o.alwaysOpen;
}
- if ( o.navigation ) {
- var current = this.element.find("a").filter(o.navigationFilter);
- if ( current.length ) {
- if ( current.filter(o.header).length ) {
- this.active = current;
- } else {
- this.active = current.parent().parent().prev();
- current.addClass("ui-accordion-content-active");
- }
- }
- }
-
this.element.addClass("ui-accordion ui-widget ui-helper-reset");
// in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
@@ -56,6 +44,20 @@ $.widget("ui.accordion", {
.next()
.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+ if ( o.navigation ) {
+ var current = this.element.find("a").filter(o.navigationFilter);
+ if ( current.length ) {
+ var header = current.closest(".ui-accordion-header");
+ if ( header.length ) {
+ // anchor within header
+ this.active = header;
+ } else {
+ // anchor within content
+ this.active = current.closest(".ui-accordion-content").prev();
+ }
+ }
+ }
+
this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.next().addClass('ui-accordion-content-active');
@@ -276,7 +278,7 @@ $.widget("ui.accordion", {
// switch classes
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
- this.active.next().addClass('ui-accordion-content-active');
+ this.active.next().removeClass('ui-accordion-content-active');
if (!clickedIsActive) {
clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
.find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);