Rick:  I think in your mouseout binding, you also need to unbind the
mousemove event handler from the document.  I think would look like this:

 

$('.clickable').mouseout(function() {

                $().unbind( 'mousemove' );

                $('div.toolTip').remove();

});

 

-- Josh

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, August 18, 2009 10:43 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] How can I modify this code to get the tooltip to
disappear?

 

I've got it appearing at the correct time and following the mouse pointer
correctly.

 

But my last bit of code isn't causing the tip to be removed.

 

Is it because the first section of code below is being triggered with every
mouse movement?

 

If so, how should I reconfigure this routine.?

 

Thanks for any feedback.

 

CODE:

 

     $(document).ready(function() {

                     

          $('.clickable').mouseover(function() {

                     

               $().mousemove(function(event) {

                           

                    $('<div class="toolTip">You must have a favorites
account<br>and be logged in to save favorites</div>').appendTo('body');

                           

                    $('div.toolTip').css({ 'top' : event.pageY - 5, 'left' :
event.pageX + 20 });

                           

                    $('div.toolTip').show();

                           

               });

          });

                           

          $('.clickable').mouseout(function() {

                           

               $('div.toolTip').remove();

                           

          });

     });

 

----------------------------------------------------------------------------
------------------------------------------

"Ninety percent of the politicians give the other ten percent a bad
reputation."  - Henry Kissinger

 

Reply via email to