EUREKA!

Using just-in-time loading my Javascript (on page load) goes from
(2285.618ms, 287605 calls) to (28.396ms, 2741 calls) on a page with
around 3,100 thumbnail image tool tips. My working code is below for
reference.

So, now I'm wondering if I should try to dispose of the tooltip on
mouseout to save memory. Any opinions on this matter?

Ivan, I have a feeling that trying to add the events on domready would
be nearly as slow as adding the tooltip object itself, due to the size
of the DOM. Though I haven't tested it. Also, I'm trying to save
filesize, so I'm not opposed to adding it via code.

Thanks again for your help Chris and Ivan. Let me know your thoughts
on adding a dispose event on mouseout.

window.addEvent('domready', function(){
        tipz  = new Tips();
});

function tipit(image, e)
{
        element = $(image);
        if(element.get("title") != null)
        {
                var content = element.get("title").split('::');
                element.store('tip:title', content[0]);
                var tipString = '';

                if(content[0] != content[1])
                        tipString += '<strong>Name: </strong>' + content[1] + 
'<br />';
                if(content[2] != '')
                        tipString += '<strong>Location: </strong>' + content[2] 
+ '<br />';
                tipString += '<strong>Followers: </strong>' + content[3];

                element.store('tip:text', tipString);

                tipz.attach(element);

                event = new Event(e); // Here's the bit I was missing
                element.fireEvent('mouseenter', event);
        }
}

Dusty

On Oct 13, 9:07 pm, "Iván N Paz" <[EMAIL PROTECTED]> wrote:
> @DustyReagan:
>
> You should really really really avoid this:
>
> >  <img onmouseover="tipit(this, event)" ...  />
>
> Specifying the javascript like that makes for very obtrusive
> javascript, which we need to avoid above all things!!!!
>
> What about applying the "tipit()" function on domready, instead of
> creating the tooltip (which you will create on your tipit).... Would
> that kill your browser as well????
>
> What about attaching a mouseMove (or the like) event to the "window"
> object and check for the object beneath????
>
> Just throwing some ideas...

Reply via email to