Actually, that solution only works in IE anyway as .height() is
reporting the wrong height in safari and chrome.

So I guess now I'm trying to find a solution to get the correct height
of an element in all browsers.

Jon

On Nov 7, 1:58 pm, jonhobbs <[EMAIL PROTECTED]> wrote:
> Hi Rik,
>
> Thanks for that, but unfortunately as I said I knew about that problem
> already and I'm not using any padding/margins.
>
> I have managed to work round the problem by getting and setting the
> height of the element usign jquery dimensions before doing the
> slideDown....
>
> $('#heading').toggle(
>     function() {
>         $('#text').slideUp(2000);
>     },
>     function() {
>         var elementHeight = $('#text').height();
> <--------- Get the computed height
>         $('#text').css('height', elementHeight + 'px');
> <--------- Set the CSS height
>         $('#text').slideDown(2000);
>     }
> );
>
> That seems to work but would still like to hear of a neater solution
> if anyone has one.
>
> Jon
>
> On Nov 7, 1:51 pm, "Rik Lomas" <[EMAIL PROTECTED]> wrote:
>
> > Hi Jon,
>
> > This article might help 
> > you:http://jqueryfordesigners.com/animation-jump-quick-tip/
>
> > Rik
>
> > 2008/11/7 jonhobbs <[EMAIL PROTECTED]>:
>
> > > Thaks Liam,
>
> > > Unfortunately it will hold dynamic content from a database so I don't
> > > know the height and can't explicitly set it. (although I did try it
> > > and that did solve the problem)
>
> > > I'm wondering if it might be possible to get the height using a more
> > > reliable method and then set it explicitly before calling slideUp?
>
> > > Anyone else solved this problem?
>
> > > Jon
>
> > > On Nov 7, 1:24 pm, Liam Potter <[EMAIL PROTECTED]> wrote:
> > >> does the div have the have no height?
> > >> if not set a height on the div, if it needs to be expandable then
> > >> someone who knows more about this will need to help you.
> > >> Though looking into the dimensions plugin may 
> > >> help.http://brandonaaron.net/docs/dimensions/#sample-2
>
> > >> jonhobbs wrote:
> > >> > I know jquery sometimes has a problem calculating the heights of
> > >> > elements that have padding/margins which can cause jumpy animations
> > >> > when using slideDown.
>
> > >> > Unfortunately I have now come across the same problem without using
> > >> > margins/padding and I've managed to create a very simple test case
> > >> > which demonstrates that it's happening on even the simplest of
> > >> > unstyled pages.
>
> > >> >http://83.138.132.232/test.htm
>
> > >> > Click the heading to make the text slide up and then click it again to
> > >> > make it slide down. You'll see that it gets to the height that it
> > >> > would have been if the width:700px wasn't there and then jumps the
> > >> > rest.
>
> > >> > Unfortunately, the element I want to slide has to be inside my main
> > >> > template which has widths set so I'm at a loss as to how to get round
> > >> > the problem.
>
> > >> > Any help would really be appreciated.
>
> > >> > Jon
>
> > --
> > Rik Lomashttp://rikrikrik.com

Reply via email to