aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.accordion.js
diff options
context:
space:
mode:
authorAlex Dovenmuehle <adovenmuehle@gmail.com>2010-12-14 23:48:36 -0500
committerAlex Dovenmuehle <adovenmuehle@gmail.com>2010-12-16 22:55:59 -0500
commit490792be6a17f53108f96e077948db5f3cbafa05 (patch)
treed31e56549fb0f06189aa7333cd0f027cc3598d5e /ui/jquery.ui.accordion.js
parentcf48a3c5c8da7bc90a9424e333d53d0e178e7885 (diff)
downloadjquery-ui-490792be6a17f53108f96e077948db5f3cbafa05.tar.gz
jquery-ui-490792be6a17f53108f96e077948db5f3cbafa05.zip
Accordion: API Redesign. Merged autoHeight, fillSpace, and clearStyle into a new option called heightStyle
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r--ui/jquery.ui.accordion.js32
1 files changed, 25 insertions, 7 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index d134d3b6b..3abb088d1 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -22,6 +22,7 @@ $.widget( "ui.accordion", {
collapsible: false,
event: "click",
fillSpace: false,
+ //heightStyle: "auto",
header: "> li > :first-child,> :not(li):even",
icons: {
header: "ui-icon-triangle-1-e",
@@ -29,10 +30,26 @@ $.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;
+ //Merge autoheight, fillSpace and clearStyle
+ options.heightStyle = options.heightStyle || self._mergeHeightStyle();
+
self.running = 0;
self.element
@@ -165,7 +182,7 @@ $.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.autoHeight || options.fillHeight ) {
+ if ( options.heightStyle != "content" ) {
contents.css( "height", "" );
}
@@ -232,12 +249,13 @@ $.widget( "ui.accordion", {
var options = this.options,
maxHeight;
- if ( options.fillSpace ) {
+ if ( options.heightStyle == "fill" ) {
if ( $.browser.msie ) {
var defOverflow = this.element.parent().css( "overflow" );
this.element.parent().css( "overflow", "hidden");
}
- maxHeight = this.element.parent().height();
+ parent = this.element.parent();
+ maxHeight = parent.height() - parent.children(':visible').not(this.element).outerHeight(true);
if ($.browser.msie) {
this.element.parent().css( "overflow", defOverflow );
}
@@ -252,7 +270,7 @@ $.widget( "ui.accordion", {
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
- } else if ( options.autoHeight ) {
+ } else if ( options.heightStyle == "auto" ) {
maxHeight = 0;
this.headers.next()
.each(function() {
@@ -398,7 +416,7 @@ $.widget( "ui.accordion", {
toHide: toHide,
complete: complete,
down: down,
- autoHeight: options.autoHeight || options.fillSpace
+ autoHeight: options.heightStyle !== "content"
};
} else {
animOptions = {
@@ -406,7 +424,7 @@ $.widget( "ui.accordion", {
toHide: toHide,
complete: complete,
down: down,
- autoHeight: options.autoHeight || options.fillSpace
+ autoHeight: options.heightStyle !== "content"
};
}
@@ -475,7 +493,7 @@ $.widget( "ui.accordion", {
return;
}
- if ( this.options.clearStyle ) {
+ if ( this.options.heightStyle == "content" ) {
this.toShow.add( this.toHide ).css({
height: "",
overflow: ""