English 中文(简体)
ery Qu drop
原标题:jQuery dropdown menu over and out

我用 j子 small了小的 drop菜,并对 mo/out事的“how”和“h”。 问题在于,当我把 mo倒在我的倒台时,事件被搁置,我的菜 disappear消失!

我也尝试了<条码>推广<>。

$( nav>div.dropTrigger ).mouseover(function(e)
{
    console.log("enter");
    $(this).find( div ).stop(true,true).animate({ opacity:  show , height:  show  },"fast");        
}); 

$( nav>div.dropTrigger ).mouseout(function(e)
{   
    console.log("out");
    $(this).find( div ).stop(true,true).animate({ opacity:  hide , height:  hide  },"fast");        
});

$( .dropdown ).mouseover(function(e)
{
    e.stopPropagation();
});

$( .dropdown ).mouseout(function(e)
{
    e.stopPropagation();
});

我的标志:

<nav>
   <div class="dropTrigger">
      <a href="potatoes">some menu</a>
       <div class="dropdown">
          <ul>[drop menu goes here]
       </div>
 ...
最佳回答
$( nav>div.dropTrigger ).on({
            mouseenter : function(){ 
                 console.log("enter");
                 $(this).find( div ).stop(true,true).animate({ opacity:  show , height:  show  },"fast");
            },
            mouseleave : function(){ 
                console.log("out");
                $(this).find( div ).stop(true,true).animate({ opacity:  hide , height:  hide  },"fast"); 
            }
        });

相反, events和 mo。 他们重温了你们描述的问题。 另外,现在优先采用的具有约束力的方法是$.on()(自jq 1.7)。

问题回答

尝试:

$( nav>div.dropTrigger ).mouseover(function(e)
{
console.log("enter");
$(this).find( div:hidden ).stop(true,true).animate({ opacity:  show , height:  show          },"fast");        
}); 

$( nav>div.dropTrigger ).mouseout(function(e)
{   
console.log("out");
$(this).find( div:visible ).stop(true,true).animate({ opacity:  hide , height:  hide    },"fast");        
});

1. 使用 mo/ele,而不是 mo/use





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签