live performs only one callback, but you can check the passed event information for the callback type:
$('.thumb.dim').live('hover', function(e) {
if (e.type == 'mouseover') {
$(this).removeClass('dim');
} else {
$(this).addClass('dim');
}
});
Alternatively, since you are just deleting / adding a class, you can do;
$('.thumb.dim').live('hover', function(e) {
$(this).toggleClass('dim');
});
source
share