我的问题是:我有一个触发器(a)和一个弹出窗口(div).div不嵌套在锚内.
我得到了大部分的结果,但是现在我已经满怀希望了.2.检查a上的mouseleave时,检查div上是否有mouseenter.如果是,我想中止mouseleave.如果没有,我想关闭div.
我究竟做错了什么?这甚至是正确的方法吗?
这是标记:
<a href="#" class="popup_toggle" style='display:block;width:50px;height:50px;border:1px solid red;position:relative;'>Toggle</a>
<div class="popup_div" style='position:absolute;top:50px;left:0px;border:1px solid blue;display:none;'>Popup</div>
Run Code Online (Sandbox Code Playgroud)
这是jQuery:
$('.popup_toggle').mouseenter(function() {
var element = $(this).next('.popup_div');
$.data(this, 'timer', setTimeout(function() {
element.show(100);
}, 500));
});
$('.popup_toggle').mouseleave(function() {
clearTimeout($.data(this, 'timer'));
if($('.popup_div').mouseenter==true)
{
return false;
}
else
{
$('.popup_div').hide(100)
};
});
Run Code Online (Sandbox Code Playgroud) 我遇到了css nth-child选择器的问题.我在容器内有一个3x3 elemtens网格.这些元素有一个叫做的类.square.随着.square:nth-child(3n+1)我选择行的每一个第一个元素和色彩是绿色的.随着.square:nth-child(3n+3)我选择行的每一个最后的元素和色彩是红色.
这很好,直到<br>在网格之前输出任何元素(例如).每一个新的<br>,订单都会向上移动一个,因为它<br>被认为是一个.square.
据我了解.nth-child,它应该选择.square该类的每个第三个元素.为什么它适用于任何元素,我如何实现我的初始目标?
提前致谢
http://www.hier-krieg-ich-alles.de/shop.php?cat=26491127728
问题出现在中间的框中.