【问题标题】:ng-mouseenter and ng-mouseleave with img and overlay causing it to flickerng-mouseenter 和 ng-mouseleave 与 img 和覆盖导致它闪烁
【发布时间】:2019-04-25 15:50:56
【问题描述】:

ng-mouseenter 和 ng-mouseleave 与 img 和覆盖导致闪烁。当它在 div 中时,这似乎不会发生。这似乎只发生在 Chrome 上。

https://next.plnkr.co/edit/S44SgCsV4vTmVLnP?preview

【问题讨论】:

    标签: javascript css angularjs


    【解决方案1】:

    问题是当你显示按钮时,会触发鼠标离开事件,因为按钮显示在鼠标光标下。在鼠标离开时,您隐藏按钮并触发鼠标输入。这就是你在无限循环中看起来像闪烁的原因。但这是预期的行为,而不是错误。将鼠标进入和鼠标离开事件提高一级。

    示例: https://next.plnkr.co/edit/tmgpXrnqqnQCr00f

    【讨论】:

    • 嗯,有趣的部分是它只发生在 img 元素上,我只在 Chrome 上看到过这种情况,而不是在 Firefox 上。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-29
    • 1970-01-01
    相关资源
    最近更新 更多