Hi,

I need help manually calling the elementEnter function on an
element... I think.

I'm using the Tool Tips plugin on my project. The problem I'm having
is that all the demo code I've seen for the Tips plugin works by
attaching a new Tip for every occurrence of your specified class as
soon as the DOM finishes loading. Like this:

var Tips1 = new Tips($$('.Tips1'));

My problem is I sometimes have many thousands of objects, and that
JavaScript is killing my browser.

I'd like to attach the element to the Tips object as soon as someone
mouses over an object, instead of trying to load every instance all at
once. I've nearly got this figured out below, but the problem is after
I do the attach, the mouse is already moused over the element (an
image in my case), so the Tip doesn't show until you move your mouse
off the element, then move it back over.

I think I can fix this by somehow manually calling elementEnter on my
image so that it causes the Tips to fire right after I've attached it.
I'm not sure how to call elementEnter manually.

Any ideas?

My code thus far:

<script type="text/javascript">

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

function tipit(image)
{
        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);

                element.fireEvent('elementEnter', element); // This doesn't 
work. :(
        }
}
</script>

Thanks!

Dusty

Reply via email to