aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.accordion.js
diff options
context:
space:
mode:
authorAlex Dovenmuehle <adovenmuehle@gmail.com>2010-12-17 21:38:29 -0500
committerAlex Dovenmuehle <adovenmuehle@gmail.com>2010-12-17 21:38:29 -0500
commit94a1786d5614aefeb1c14e492126bfe8aa28a804 (patch)
tree58096614935041c9e64f1c266f447e2a2922ec32 /ui/jquery.ui.accordion.js
parent490792be6a17f53108f96e077948db5f3cbafa05 (diff)
downloadjquery-ui-94a1786d5614aefeb1c14e492126bfe8aa28a804.tar.gz
jquery-ui-94a1786d5614aefeb1c14e492126bfe8aa28a804.zip
Accordion: API Redesign. Made style changes and changed 'fill' implementation to use $.siblings()
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r--ui/jquery.ui.accordion.js49
1 files changed, 27 insertions, 22 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 3abb088d1..ccad15262 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -17,11 +17,11 @@ $.widget( "ui.accordion", {
options: {
active: 0,
animated: "slide",
- autoHeight: true,
- clearStyle: false,
+ autoHeight: true, //DEPRECATED - use heightStyle: "auto"
+ clearStyle: false, //DEPRECATED - use heightStyle: "content"
collapsible: false,
event: "click",
- fillSpace: false,
+ fillSpace: false, //DEPRECATED - use heightStyle: "fill"
//heightStyle: "auto",
header: "> li > :first-child,> :not(li):even",
icons: {
@@ -30,19 +30,6 @@ $.widget( "ui.accordion", {
}
},
- _mergeHeightStyle: function() {
- options = this.options;
-
- if (options.fillSpace)
- return "fill";
-
- if (options.clearStyle)
- return "content";
-
- if (options.autoHeight)
- return "auto";
- },
-
_create: function() {
var self = this,
options = self.options;
@@ -182,13 +169,29 @@ $.widget( "ui.accordion", {
.css( "display", "" )
.removeAttr( "role" )
.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
- if ( options.heightStyle != "content" ) {
+ if ( options.heightStyle !== "content" ) {
contents.css( "height", "" );
}
return $.Widget.prototype.destroy.call( this );
},
+ _mergeHeightStyle: function() {
+ var options = this.options;
+
+ if ( options.fillSpace ) {
+ return "fill";
+ }
+
+ if ( options.clearStyle ) {
+ return "content";
+ }
+
+ if ( options.autoHeight ) {
+ return "auto";
+ }
+ },
+
_setOption: function( key, value ) {
$.Widget.prototype._setOption.apply( this, arguments );
@@ -249,13 +252,15 @@ $.widget( "ui.accordion", {
var options = this.options,
maxHeight;
- if ( options.heightStyle == "fill" ) {
+ if ( options.heightStyle === "fill" ) {
if ( $.browser.msie ) {
var defOverflow = this.element.parent().css( "overflow" );
this.element.parent().css( "overflow", "hidden");
}
- parent = this.element.parent();
- maxHeight = parent.height() - parent.children(':visible').not(this.element).outerHeight(true);
+ maxHeight = this.element.parent().height();
+ this.element.siblings( ":visible" ).each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
if ($.browser.msie) {
this.element.parent().css( "overflow", defOverflow );
}
@@ -270,7 +275,7 @@ $.widget( "ui.accordion", {
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
- } else if ( options.heightStyle == "auto" ) {
+ } else if ( options.heightStyle === "auto" ) {
maxHeight = 0;
this.headers.next()
.each(function() {
@@ -493,7 +498,7 @@ $.widget( "ui.accordion", {
return;
}
- if ( this.options.heightStyle == "content" ) {
+ if ( this.options.heightStyle === "content" ) {
this.toShow.add( this.toHide ).css({
height: "",
overflow: ""