I just hit this problem myself.
I have done a bit of investigation, and I have a different solution and may
have uncovered a bug.
I am working with rev. 249
Bug first...
Somewhere around line 1313 is
setAuto: function(e,p)
in the middle of this function is a check
if ( p == "height" && e.scrollHeight != o ||
p == "width" && e.scrollWidth != o ) return;
it seems that e.scrollHeight is returning a number and o is returning a
string with 'px' at the end. So they never match and setAuto always bails
I fixed this like this
if ( p == "height" && e.scrollHeight+"px" != o ||
p == "width" && e.scrollWidth+"px" != o ) return;
I *think* this is right. I don't know what bad side-effects this may have.
Anyone know if this is a bug or not?
Back to point of the problem with nested divs...
After making the changes above
Around line 1507 is the following
// Reset the property, if the item has been hidden
if ( z.o.hide ) {
for ( var p in z.el.curAnim ) {
y[ p ] = z.el.orig[p] + ( p == "opacity" ? "" : "px" );
// set its height and/or width to auto
if ( p == 'height' || p == 'width' )
jQuery.setAuto( z.el, p );
}
}
By removing the check to see if the element has been hidden, the nested divs
work fine
// Reset the property, if the item has been hidden
//if ( z.o.hide ) {
for ( var p in z.el.curAnim ) {
y[ p ] = z.el.orig[p] + ( p == "opacity" ? "" : "px" );
// set its height and/or width to auto
if ( p == 'height' || p == 'width' )
jQuery.setAuto( z.el, p );
}
//}
Again, I am not sure if this is right and what sort of side-effects this
will have.
Anyone care to tell me the bad things that I have unleashed on myself?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Mika Tuupola
Sent: Wednesday, October 04, 2006 2:13 AM
To: jQuery Discussion.
Subject: Re: [jQuery] slideUp / slideDown and nested divs
On Oct 4, 2006, at 11:16, Mika Tuupola wrote:
> ** Example 1:
> http://www.appelsiini.net/~tuupola/jquery/slideupdown/
> slideupdown2.html
> ** Example 2:
> http://www.appelsiini.net/~tuupola/jquery/slideupdown/
> slideupdown3.html
Answering to myself here. It seems that calling slideDown() also sets
elements absolute height in pixels. Thus any nested divs will be broken.
-cut-
<div id="folder-1" style="overflow: visible; display: block; height:
240px;">
-cut-
Workaround for this would be using callback after slideUp/Down which
removes the height. For example:
-cut-
$("a.folder").toggle(function(e) {
$(this).parent().next().slideDown('fast', function() {
$(this).height('');
});
}, function(e) {
$(this).parent().next().slideUp('fast', function() {
$(this).height('');
});
});
-cut-
Working example:
http://www.appelsiini.net/~tuupola/jquery/slideupdown/slideupdown4.html
--
Mika Tuupola
http://www.appelsiini.net/~tuupola/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/