-1

参考这个问题

当 mouseenter 在每个项目上时,其覆盖消失,当 mouseleave - 覆盖显示。

当我有更多物品并随机快速悬停在它们上时,它们不会恢复到以前的状态。这很烦人:/

这是为什么?

 $('.item').mouseenter(function () {
var $this = $(this);
setTimeout(function () {
    $this.find('.item-overlay').css('z-index', '-1');
}, 300);
 }).mouseleave(function () {
$(this).find('.item-overlay').css('z-index', '1');
 });

http://jsfiddle.net/w3Gha/

4

2 回答 2

1

尝试悬停():http: //jsfiddle.net/KfS9H/

  $(".item").hover(
      function () {
           $(this).find('.item-overlay').stop().css('z-index', '-1');
      },
      function () {
           $(this).find('.item-overlay').stop().css('z-index', '1');
      }
  );
于 2013-07-31T08:44:03.680 回答
0

试试这个:- http://jsfiddle.net/adiioo7/w3Gha/1/

使用$('.item iframe')而不是$('.item').

JS:-

$('.item iframe').mouseenter(function () {
    var $this = $(this);
    setTimeout(function () {
        $this.find('.item-overlay').css('z-index', '-1');
    }, 300);
}).mouseleave(function () {
    $(this).find('.item-overlay').css('z-index', '1');
});
于 2013-07-31T08:34:25.740 回答