Accordion: fixed jump in accordion when expander div has padding.

This commit is contained in:
Ca-Phun Ung 2008-09-25 18:50:11 +00:00
parent b5ce43ac6a
commit a23a88a0ca

View File

@ -253,8 +253,9 @@ $.extend($.ui.accordion, {
} }
var hideHeight = options.toHide.height(), var hideHeight = options.toHide.height(),
showHeight = options.toShow.height(), showHeight = options.toShow.height(),
difference = showHeight / hideHeight; difference = showHeight / hideHeight,
options.toShow.css({ height: 0, overflow: 'hidden' }).show(); padding = options.toShow.outerHeight() - options.toShow.height();
options.toShow.css({ height: 0, overflow: 'hidden', marginBottom: -padding }).show();
options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{ options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
step: function(now) { step: function(now) {
var current = (hideHeight - now) * difference; var current = (hideHeight - now) * difference;
@ -269,6 +270,7 @@ $.extend($.ui.accordion, {
if ( !options.autoHeight ) { if ( !options.autoHeight ) {
options.toShow.css("height", "auto"); options.toShow.css("height", "auto");
} }
options.toShow.css("marginBottom", 0);
options.complete(); options.complete();
} }
}); });