第二次单击自定义工具提示时,绝对位置跨度消失
检查此代码。
<li>one <a href="#" class="opt">delete</a>
<div class="popup">
<span class="tip"></span><a href="#" class="btn">deletebutton</a></div>
</li>
用于隐藏/显示 div.popup
的代码
$('.opt').live('click', function(e) {
e.preventDefault();
$(".popup").slideUp();
$(this).closest("li").find(".popup").stop(true, false).slideToggle();
});
单击删除以打开每个 div.popup
,但第二次单击打开的 div.popup
会使span.tip
消失。不刷新页面就不再出现。
$(".popup").slideUp();
我发现问题是由于这段代码造成的。我使用此代码在单击任何删除锚点时隐藏所有其他打开的 .popup
。我是 jQuery 新手。任何人都可以建议一种替代方法来隐藏 div.popup
兄弟姐妹点击任何。
谢谢..
Check this code.
<li>one <a href="#" class="opt">delete</a>
<div class="popup">
<span class="tip"></span><a href="#" class="btn">deletebutton</a></div>
</li>
code used to hide/show div.popup
$('.opt').live('click', function(e) {
e.preventDefault();
$(".popup").slideUp();
$(this).closest("li").find(".popup").stop(true, false).slideToggle();
});
In click delete to open each div.popup
but second click on the opened div.popup
makes the span.tip
to disappear. It does not appear anymore without refreshing page.
$(".popup").slideUp();
I found the problem is due to this code. I'm using this code to hide all other opened .popup
on click of any delete anchor. I'm new to jQuery. Can anyone suggest an alternative method to hide div.popup
siblings on click on any.
Thanks..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是,在slideToggle期间,jQuery正在将弹出元素更改为“overflow-x:hidden”,因此超出边界的tip元素保持隐藏状态。我对 jsfiddle 进行了更新,使其包含弹出 div 内的提示元素。动画看起来有点不同,但我相信你可以通过一些技巧让它看起来像以前一样。 http://jsfiddle.net/6vKct/5/ (我将提示更改为蓝色背景这样它就更明显)
我将
实际上,我只是使弹出 div 更大,将其向上移动并将尖端移到其中。
The problem is that during slideToggle jQuery is changing the popup element to have "overflow-x: hidden" thus the tip element, which is outside of the bounds stays hidden. I made an update to the jsfiddle so that it includes the tip element inside of the popup div. The animation looks a little different but I'm sure you can get it to look like it used to with a little finessing. http://jsfiddle.net/6vKct/5/ (I changed the tip to have a blue background so that it's more visible)
I changed
In effect I just made the popup div larger, moved it up and moved the tip inside of it.
添加停止(true,true)
http://jsfiddle.net/6vKct/2/
add stop(true,true)
http://jsfiddle.net/6vKct/2/