jQuery向下滑动div-在其上方消失
问题描述:
我正在做一个带有下拉菜单的下拉菜单.
I have doing a slide down menu with options in the slide down.
我正在使用以下jQuery
I am using the following jQuery
$(document).ready(function() {
$(".menu_item").hover(function() {
$(".menu_options").slideDown(400);
}, function() {
$(".menu_options").slideUp(400);
});
});
我遇到的问题是,当它向下滑动时,我继续向下滑动的div消失了-这是设置的屏幕截图
The problem I have is that when it slides down and I go on to the div that has slid down it disappears - here is the screenshot of the set up
此区域的HTML是
<div class="menu">
<div class="menu_item" id="1">
Landlord Packages
</div>
<div class="spacer"></div>
<div class="menu_item">
Single Items
</div>
<div class="menu_options" id="1"></div>
</div>
在此先感谢您的帮助:-)
Thank you in advance for your help :-)
JSFiddle脚本 http://jsfiddle.net/pCTXq/
JSFiddle script http://jsfiddle.net/pCTXq/
答
尝试
$(document).ready(function() {
$(".menu_item, .menu_options").hover(function() {
$(".menu_options").stop(true, true).slideDown(400);
}, function() {
$(".menu_options").stop(true, true).delay(10).slideUp(400);
});
});
这应该可以满足您的需求.
This should do what you need.
我的小提琴: http://jsfiddle.net/MCvsd/54/
您提供的小提琴,已更新: http://jsfiddle.net/pCTXq/1/
the fiddle you provided, updated: http://jsfiddle.net/pCTXq/1/