开发者

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

开发者 https://www.devze.com 2023-03-18 06:41 出处:网络
Is it function in jQuery? Pseudo code: $(\'.smth\').bind(\'mouseout\', function(){ if(开发者_运维知识库$(\'.certain_class\').magic_function()) {

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

精彩评论

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