views:

205

answers:

1

Some cells in my SlickGrid table have myClass class.

I added a tooltip for them like this:

$(".myClass").hover(// Mouse enters
                    function(e) {...},
                    // Mouse leaves
                    function() {...});

It works fine, but if I scroll the table to the bottom, and then scroll it back to the top, the tooltip does not appear anymore.

Can someone suggest any workaround ?

Thanks !

+2  A: 

try:

$('.myClass').live('mouseover mouseout', function(event) {
 // works only on jQuery 1.4.1 and up
  if (event.type == 'mouseover') {
    // Mouse enters 
  } else {
    // Mouse leaves
  }
});

if that doesn't work, I'm guessing .myClass has been remove so try adding it again in every scrolls...

either way, use the live()

Reigel
Excellent ! It works :) One thing bothers me: I see in docs that "The .hover() method binds handlers for both mouseenter and mouseleave events". So, why replacing `mouseover` with `mouseenter` will not work ? I checked and found out that if I put `mouseenter` instead of `mouseover`, then `function(event) {..}` is called also while `event.type = "mouseover"`. Why is that ? Thanks for your help !
Misha Moroshko
`hover()` does not work on `live()`...
Reigel