【问题标题】:Jquery with mouseover that works only on hover带有鼠标悬停的 Jquery 仅适用于悬停
【发布时间】:2018-07-04 15:55:52
【问题描述】:

我在使用 jquery 鼠标悬停时遇到了一些困难。

我只想在鼠标悬停在图像上时发生失真效果,而不是在鼠标离开时发生。我使用 mgGlitch 来实现效果,并使用 jquery 来实现悬停。感谢您的帮助!

JQUERY

$(".glitch-img").hover(function() {
    $( ".glitch-img" ).mgGlitch({
      // set 'true' to stop the plugin
              destroy : false,
      // set 'false' to stop glitching
      glitch: true,
      // set 'false' to stop scaling
      scale: true,
      // set 'false' to stop glitch blending
      blend : true,
      // select blend mode type
      blendModeType : 'hue',
      // set min time for glitch 1 elem
      glitch1TimeMin : 200,
      // set max time for glitch 1 elem
      glitch1TimeMax : 400,
      // set min time for glitch 2 elem
      glitch2TimeMin : 10,
      // set max time for glitch 2 elem
      glitch2TimeMax : 100,
    }),


    // .mouseout(function() {
    //      $(".glitch-img").myGlitch({
    //          // set 'true' to stop the plugin
    //                destroy : false,
    //          // set 'false' to stop glitching
    //          glitch: false,
    //          // set 'false' to stop scaling
    //          scale: false,
    //          // set 'false' to stop glitch blending
    //          blend : false,
    // })

});

【问题讨论】:

    标签: javascript jquery html hover


    【解决方案1】:

    来自JQuery Docs

    .hover() 方法为 mouseenter 和 mouseleave 事件绑定处理程序。

    您想要做的是将事件绑定到mouseover() 函数。 Reference

    【讨论】:

      猜你喜欢
      • 2011-08-04
      • 1970-01-01
      • 1970-01-01
      • 2015-03-27
      • 2011-11-13
      • 1970-01-01
      • 1970-01-01
      • 2011-07-07
      • 2013-07-16
      相关资源
      最近更新 更多