How to target only the current hovering div with jquery when there are many other divs with the same class?

前端 未结 1 1189
太阳男子
太阳男子 2020-12-20 01:43

How to target only current div (that I am hovering over) and not all divs with the same class using jQuery hover() function?

My code is something like this (I have m

相关标签:
1条回答
  • 2020-12-20 02:19

    Use this, which is the target of the event, along with jQuery traversal functions:

    $('a.video-item-link').hover(function() {
         // in
         $(this).find('div.mouseover').show();
      }, function() {
         // out
         $(this).find('div.mouseover').hide();
      }
    );
    

    Though from your markup, it looks like you need $(this).find('div.mouseover-element')

    0 讨论(0)
提交回复
热议问题