📜  悬停时的 jquery 选择器父级 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.535000             🧑  作者: Mango

代码示例2
//styling child while mouse is inside child element
$('child').on('hover', function(e){
   if (e.type == 'mouseenter'){
      $(this).css('background','yellow');
   }
})

   // styling child while mouse is inside parent
$('child').parents().on('hover', function (e){
   if (e.type == 'mouseenter'){
      $(this).css('background', 'blue');
   }
})