我正在创建一个在悬停时向下滑动的下拉菜单。这是我的一些代码。我想使用 HoverIntent 来实现这个目标。
.menu_img 是图像上悬停以开始向下滑动列表的类
.page_nav 是当 .menu_img 悬停在列表上时向下滑动的类。
$(document).ready(function(){
$('img.menu_img').click(function () {
$('ul.page_nav').stop().slideDown('slow');
});
});
HTML
<div id="helper_bar">
<div class="page_width">
<img src="images/page_nav.png" alt="page_nav" title="use this to navigate the page" class="menu_img" width="179" height="33" />
</div>
</div>
<div class="page_width">
<ul class="page_nav">
<li><a href="#">About</a></li>
<li><a href="#">Services Offered</a></li>
<li><a href="#">The Team</a></li>
<li><a href="#">The Process</a></li>
</ul>
</div>
这是我拥有的代码。如果您单击 img,则此方法有效,但如果您将 .click 切换为 .hover,则当您尝试转到 li 时,它将悬停在外。这就是为什么我引入了 hoverIntent 插件,但我不确定如何集成它以获得我正在尝试创建的正确解决方案。
BTW i didn't include the HTML code but its a simple image and ul li tags which I know are working fine. There is a display: none; on the ul li and I did some stuff to make it funciton properly in my layout. (i have the layout a bit different than a regular dropdown.) Either way, I'm very certain my CSS is right, I just need to figure out how to write the Jquery. Thanks!