Had to modify your code some to get it to run properly (replaced the
$.each with a for loop which I think replicated what you were getting
at ).  While the function did go faster, the difference was hardly
noticible, something like 10ms off the runtime of around 5100ms. Oh
well, it was worth a try. :)

On Jun 19, 4:31 pm, "Benjamin Sterling"
<[EMAIL PROTECTED]> wrote:
> IE does, but it is $100 or something like that. :(
>
> On 6/19/07, Gordon <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Thanks, I'll give your code a try.
>
> > Interestingly the problem seems to be far worse in FireFox 1.5 than in
> > my other test browsers.  The CPU is pegged for a full six seconds and
> > FireBug confirms that this is how long it's taking for my various init
> > functions to run, and that hte one that loops over the elements is the
> > one that is taking a siginficant chunk of the time.  In my other test
> > browsers (ie6, ie7, Opera 8, Oper 9, Safari 3 beta/Win) the CPU
> > pegging lasts for a second or less.  It's a shame these other browsers
> > don't have a development tool like the full blown version of
> > FireBug.
>
> > On Jun 19, 2:27 pm, "Benjamin Sterling"
> > <[EMAIL PROTECTED]> wrote:
> > > Gordon,
> > > I would suspect that there is very little you can do to speed up the
> > > processing on 120 elements, but I could be completely wrong on that
> > since I
> > > would not know the first thing to truly increase speed.  But I am
> > curious if
> > > something like below would speed it up (not tested):
>
> > > $.each($('.elemsToAnimate').size(), function(i){
> > > var thisElem = $('.elemsToAnimate')[i];
> > > thisElem.css ({
> > >                top             : this.offsetTop        - parseInt (
> > > thisElem.css ('margin-top'), 10),
> > >                left    : this.offsetLeft       - parseInt
> > > (thisElem.css('margin-left'),10),
> > >                width   : 100,
> > >                height  : 100
>
> > > });
> > > });
>
> > > It is more or less the same function just change to $.each
>
> > > On 6/19/07, Gordon <[EMAIL PROTECTED]> wrote:
>
> > > > I am using a loop to initialize some elements for animation (befor
> > > > initialization they are allowed to float, but for the animation
> > > > process itself their positions need to be absolute). My code is as
> > > > follows.
>
> > > > $('.elemsToAnimate').each (function ()
> > > > {
> > > >         var thisElem = $(this);
> > > >         thisElem.css ({
> > > >                 top             : this.offsetTop        - parseInt (
> > > > thisElem.css ('margin-top'), 10),
> > > >                 left    : this.offsetLeft       - parseInt (
> > thisElem.css('margin-left'),
> > > > 10),
> > > >                 width   : 100,
> > > >                 height  : 100
> > > >         });
> > > > });
>
> > > > This achieves the desired effect, namely fixing elements that were
> > > > previously allowed to float to an absolute position for animating, but
> > > > the function runs rather slow.  In fact it can take over 4 seconds to
> > > > run on a list containing 120 elements.
>
> > > > I could really do with some help finding a speedup, if you have any
> > > > tips I'd appreciate hearign them.
>
> > > --
> > > Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com
>
> --
> Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com

Reply via email to