Hmm, that's because when firing an event, an event object isn't passed
to the function. That's why event.page isn't defined. If you're
attaching the tooltips on mouseover, then you should just be able to
pass the event object created from that to mouseenter, instead of
element.
Not sure if this would work either, but you could try attaching a tip
on mouseenter and you wouldn't have to fire it manually.
On Oct 13, 12:19 pm, DustyReagan <[EMAIL PROTECTED]> wrote:
> You're my hero Chris. That did it!
>
> However, it's causing 'event.page' to be undefined, and an error is
> thrown in the position: function(event) method of Tips. I'm working on
> debugging that now, but if you have any ideas on how to get rid of
> that error, I'm all ears! :)
>
> Dusty
>
> On Oct 13, 8:46 am, Chris J <[EMAIL PROTECTED]> wrote:
>
> > Haven't tried it, but try firing mouseenter instead of elementEnter.
>
> > On Oct 12, 7:37 pm, DustyReagan <[EMAIL PROTECTED]> wrote:
>
> > > 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