繁体   English   中英

带有mouseover的jQuery仅在悬停时有效

[英]Jquery with mouseover that works only on hover

我在使用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,
    // })

});

JQuery Docs中

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM