diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-12-12 19:23:28 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-12-12 19:23:28 +0000 |
commit | 28c5c53a09d1218e3688aaedc9665ea5ad772cc2 (patch) | |
tree | 97dde8730ebc4ba562327790f8d9232eb360d5ec /ui/ui.accordion.js | |
parent | ad19cf1b4c58780ab3e31d420459c7c1837a99cb (diff) | |
download | jquery-ui-28c5c53a09d1218e3688aaedc9665ea5ad772cc2.tar.gz jquery-ui-28c5c53a09d1218e3688aaedc9665ea5ad772cc2.zip |
Accordion: #3646 - add hover classes and unbind on destroy
Diffstat (limited to 'ui/ui.accordion.js')
-rw-r--r-- | ui/ui.accordion.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js index f2e107939..10cbcb5b9 100644 --- a/ui/ui.accordion.js +++ b/ui/ui.accordion.js @@ -31,7 +31,9 @@ $.widget("ui.accordion", { this.element.addClass("ui-accordion ui-widget ui-helper-reset"); var groups = this.element.children().addClass("ui-accordion-group"); - var headers = options.headers = groups.find("> :first-child").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"); + var headers = options.headers = groups.find("> :first-child").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all") + .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); }) + .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); }); // wrap content elements in div against animation issues headers.next().wrap("<div/>").addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); @@ -100,7 +102,7 @@ $.widget("ui.accordion", { this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion"); $.removeData(this.element[0], "accordion"); var groups = this.element.children().removeClass("ui-accordion-group selected"); - var headers = this.options.headers.removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") + var headers = this.options.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex"); headers.find("a").removeAttr("tabindex"); headers.children(".ui-icon").remove(); |