views:

742

answers:

1

I'm using qtip ( http://craigsworks.com/projects/qtip/ ) to make tooltips. Now I need to show tooltips when button is pressed and hide tooltips for example when 3 seconds has passed. My current code is not working, tooltips will sometimes go away and sometimes stay...

var self = $("#email");
     self.qtip( { 
      content: error, 
      tip: true,
      position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, 
      style: 'error',
      show: { when: false, ready: true }, 
      hide: { when: { event: 'mousemove' }, delay: 2000, effect: function() { self.qtip("destroy"); } }
     } );
+1  A: 

@newbie, but a response, is to tidy the code and that maybe that's the problem. eg replacing the name of the variable "self" by "this".

$("#email").qtip( { 
   content: error, 
   tip: true,
   position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, 
   style: 'error',
   show: { when: false, ready: true }, 
   hide: { when: { event: 'mousemove' }, 
           delay: 2000, 
           effect: function() { $(this).qtip("destroy"); }
         }
});
andres descalzo
Well, I have to try that when I'll go back to work tomorrow.
newbie
isn't it a bit violent to catch the mousemove event ? also this won't work if the user doesn't move the mouse
marcgg