且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jquery mouseover和mouseout需要为特定元素工作

更新时间:2023-10-30 12:54:16

使用$(this)而不是全局类,这显然会影响所有项目与该类。

Use $(this) instead of global class, which will obviously affect all items with that class. By using THIS you are targeting specific item that was hovered.

  $(".hot_post_thumbnail").mouseover(function(){
     $(this).parent().siblings(".hot_post_title").css("display","block");
  });

  $(".hot_post_thumbnail").mouseout(function(){
     $(this).parent().siblings(".hot_post_title").css("display","none");
  });

复制粘贴应该可以做到。

Copy pasting this should do the trick.

要设置延迟效果,请使用show()。

To set delay effect use show() instead.

  $(".hot_post_thumbnail").mouseover(function(){
     $(this).parent().siblings(".hot_post_title").show("100");
  });

  $(".hot_post_thumbnail").mouseout(function(){
     $(this).parent().siblings(".hot_post_title").hide("100");
  });

当您想立即设置css设置时使用css。

Use css when you want to set css settings instantly.