当鼠标悬停在子菜单下方时,如何防止鼠标悬停? [英] How to prevent hide-on-mouseleave when hovering over child drop-down-menu?
问题描述
如果在 http://jsfiddle.net/MG4hw/12/ 中点击红色开始 - 按钮,显示一个iframe元素。当您悬停iframe元素时,它再次被隐藏。到目前为止,这是所期望的行为。
If in http://jsfiddle.net/MG4hw/12/ you click on the red "start"-button, an iframe-element is displayed. When you hover off the iframe-element it is again hidden. So far that's the desired behaviour.
然而,不用说,只要我打开任何下拉菜单,iframe也会被隐藏菜单,并将鼠标悬停在下拉列表中,以便选择一个值。通过任何,我的意思是不仅仅是下拉菜单,如由我编码的选择字段,也可以是例如。
What's not desired, however, is that the iframe is also hidden whenever I open any drop-down-menu inside it and hover over the drop-down in order to select a value. By any I mean not just drop-down-menus like select-fields coded by me, but also e.g. autocomplete suggestions by the web browser pertaining to input-fields.
至少对于第一种情况(由编码的选择字段)我假设这样一个下拉菜单中的代码如下(如果您设法滚动到右侧,您也可以在小提琴中找到相应的生日字段):
At least for the first case (the select-field coded by me), let's assume the code underlying such a drop-down-menu is as follows (you also find the according birthday-field in the fiddle if you manage to scroll all the way to the right):
<fieldset>
<legend>Geburtstag</legend>
<select name="birthDay" id="birthDay">
<option value="tag">Day</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
...
</select>
</fieldset>
当悬停在下拉菜单中时,如何防止iframe消失?
How can I prevent the iframe from disappearing when hovering over the drop-down-menu?
非常感谢您提前!
推荐答案
this has somehow to do with this problem. dont ask me why, but this works for me.
$('#iframe_register').on("mouseleave", function (e) {
if(e.relatedTarget != null) {
$(this).hide();
}
});
这篇关于当鼠标悬停在子菜单下方时,如何防止鼠标悬停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!