开发者

Is it possible to check if the mouse pointer is on the certain class?

Is it function in jQuery? Pseudo code:

$('.smth').bind('mouseout', function(){
    if(开发者_运维知识库$('.certain_class').magic_function()) {
      $('.fading_object_class').fadeOut("fast");
    }
});

If mouse pointer is not on the class certain_class, it would fade.

P.S. It's for my tooltip plugin.


Here's some pseudo-code. But the main point here is that you can use hasClass if the element that the mouse pointer left has a certain class:

$('.smth').bind('mouseout', function(){
    if($(this).hasClass('certain_class')) {
      $('.fading_object_class').fadeOut("fast");
    }
});

Or if something else has a certain class:

$('.smth').bind('mouseout', function(){
    if($('#something_else').hasClass('certain_class')) {
      $('.fading_object_class').fadeOut("fast");
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜