【问题标题】:unexpected onmouseout意外的鼠标退出
【发布时间】:2011-02-17 14:15:05
【问题描述】:

我在“http://dev.moragues.pe/austral/es/#/nosotros/organizacion/gerencia/”上有一个画廊我已经注册了两个活动

    jQuery('.ngg-gallery-thumbnail a img')
        .live('mouseover',function() {
    alert('a');
            jQuery(this).css('zIndex','100').addClass("hover").stop()
            .animate({
                top: '0',
                left: '0',
                width: '415px',
                height: '315px'
            }, 600);
        })
        .live('mouseout',function(){
    alert('b');
            it = jQuery(this).attr('initialTop');
            il = jQuery(this).attr('initialLeft');
            jQuery(this).removeClass("hover").stop()
            .animate({
                top: it,
                left: il,
                width: '105px',
                height: '80px'
            }, 600,function(){
jQuery(this).css('zIndex','0').addClass("hover").stop()
});
        });

但是当我将鼠标放在 div 上时,我再次看到了 alert('a')、alert('b') 和 alert('a') 但我刚刚通过了鼠标(所以我认为它是只有一个事件)

我发生在 google chrome 和 Internet Explorer 中。有没有人有什么想法?

【问题讨论】:

  • 您发布的链接似乎链接了 Wordpress 安装页面。我建议亲自编辑。
  • é,我不介意,我只是有点担心您网站的安全性...

标签: jquery mouseover mouseout


【解决方案1】:

该问题仅在使用 alert() 时发生,它将焦点设置在警报框上,导致 mouseover 事件多次触发。

当我将alert 更改为console.log 或其他操作时,它只会触发一次。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-27
    相关资源
    最近更新 更多