Skip to content
Permalink
Browse files

accordion: fix for #3626, refactoring resize code into its own public…

… method
  • Loading branch information
jzaefferer committed Dec 22, 2008
1 parent 47938b3 commit 02e8e4d298f791b0ae962062d06f268e3c268afb
Showing with 21 additions and 16 deletions.
  1. +21 −16 ui/ui.accordion.js
@@ -47,22 +47,7 @@ $.widget("ui.accordion", {
this.element.find('a').css('zoom', '1');
}

var maxHeight;
if ( options.fillSpace ) {
maxHeight = this.element.parent().height();
options.headers.each(function() {
maxHeight -= $(this).outerHeight();
});
var maxPadding = 0;
options.headers.next().each(function() {
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
}).height(maxHeight - maxPadding);
} else if ( options.autoHeight ) {
maxHeight = 0;
options.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight);
}
this.resize();

this.element.attr('role','tablist');

@@ -144,6 +129,26 @@ $.widget("ui.accordion", {

return true;
},

resize: function() {
var options = this.options,
maxHeight;
if ( options.fillSpace ) {
maxHeight = this.element.parent().height();
options.headers.each(function() {
maxHeight -= $(this).outerHeight();
});
var maxPadding = 0;
options.headers.next().each(function() {
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
}).height(maxHeight - maxPadding);
} else if ( options.autoHeight ) {
maxHeight = 0;
options.headers.next().each(function() {
maxHeight = Math.max(maxHeight, $(this).outerHeight());
}).height(maxHeight);
}
},

activate: function(index) {
// call clickHandler with custom event

0 comments on commit 02e8e4d

Please sign in to comment.
You can’t perform that action at this time.