Opened 11 years ago

Closed 11 years ago

#4442 closed bug (fixed)

resize function with autoheight

Reported by: guile Owned by:
Priority: minor Milestone: 1.8
Component: ui.accordion Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

based on version 1.7.1.

There is a problem with the resize function for autoHeight when it sets the new height based on the maxHeight. MaxHeight is calculated based on the outerHeight which is normal but then it sets the height of each element based on maxHeight. It should set the height of the element based on maxHeight -(border and padding of this resized element). Below is my bugfix proposition. I tested it and it works.

Current code from line 191:

} else if ( o.autoHeight ) {

maxHeight = 0; this.headers.next().each(function() {

maxHeight = Math.max(maxHeight, $(this).outerHeight());

}).height(maxHeight);

}

My solution: from line 191

} else if ( o.autoHeight ) {

maxHeight = 0; this.headers.next().each(function() {

maxHeight = Math.max(maxHeight, $(this).outerHeight());

}).height(function(){

return maxHeight-$(this).outerHeight()+$(this).height()

});

}

Change History (4)

comment:1 Changed 11 years ago by guile

Sorry but I made a mistake.

This is a better code

} else if ( o.autoHeight ) {

maxHeight = 0; this.headers.next().each(function() {

maxHeight = Math.max(maxHeight, $(this).outerHeight());

}).each(function() {

var newHeight=maxHeight-$(this).outerHeight()+$(this).height();
(this).height(newHeight);

});

}

comment:2 Changed 11 years ago by guile

OK sorry again the mistakes above. Here it looks a lot better.

This is what I suggest from line 191:

} else if ( o.autoHeight ) {
  maxHeight = 0;
  this.headers.next().each(function() {
    maxHeight = Math.max(maxHeight, $(this).outerHeight());
  }).each(function() {
    var newHeight=maxHeight-$(this).outerHeight()+$(this).height();
    $(this).height(newHeight);
  });
}

comment:3 Changed 11 years ago by Scott González

Milestone: TBD1.8

comment:4 Changed 11 years ago by Jörn Zaefferer

Resolution: fixed
Status: newclosed

Fixed in r3038. The change is to just use height() instead of outerHeight(), making it much simpler then what you proposed.

Please reopen this ticket if that isn't enough for you, preferably with a usecase included.

Note: See TracTickets for help on using tickets.