在菜单目标上禁用mouseenter

时间:2014-06-02 00:26:04

标签: javascript jquery html

使用menu-aim:

https://github.com/hfknight/jQuery-menu-aim/blob/master/jquery.menu-aim.js

有一个问题响应它。它使用mouseenter,我需要使用click.function() {}禁用鼠标中心。如果您查看底部插件(上图)中的代码,您会看到以下事件:

  $menu
            .mouseleave(mouseleaveMenu)
            .find(options.rowSelector) // here 
                .mouseenter(mouseenterRow) // and here
                .mouseleave(mouseleaveRow)
                .click(clickRow);

        $(document).mousemove(mousemoveDocument);

我想在此.click(function (){})

中禁用鼠标悬停事件
  $('[data-toggle="offcanvas"]').click(function () {


  });

这是一个不正确的代码,因此您可以更好地理解我想要实现的目标:

   $('[data-toggle="offcanvas"]').click(function () {
    $(".dropdown-menu").menuAim({
       activate: function(){disable mouseenter here }  
       });
    });

1 个答案:

答案 0 :(得分:1)

TL; DR

不太明白,但这样你可以off任何事件。你可以尝试一下:

// For all elements with an identifier
function(){ $('elementIdOrClass').off('mouseenter'); } 

// For current element only
function(){ $(this).off('mouseenter'); }

您也可以使用unbind('mouseenter')