gpt4 book ai didi

jquery-tools - jQuery工具: How to close an overlay?

转载 作者:行者123 更新时间:2023-12-04 20:23:41 24 4
gpt4 key购买 nike

我有一个使用Jquery工具显示为覆盖图的编辑表单。

在我的对象 ListView 页面上,每个对象都有<a href="#" class="edit_button">Edit</a>。所有这些都通过以下方式附加到相同的叠加形式:

        $(".edit_button[rel]").overlay({ top: '5px',
fixed: false,

mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.9
}
});

编辑表单叠加层包含一个取消按钮:
<a href="#" class="cancel">Cancel</a>

如何使该取消按钮关闭覆盖图?看来,我能够访问Overlay API对象的唯一方法是使用创建它的选择器-在这种情况下为 $('.edit').each(),因为我不知道哪个触发了覆盖。

我真正想做的是:
$('.cancel').click(function(e){
var target = e.originalTarget || e.srcElement;
$(target).parent().parent().getOverlay().close();
});

但这是行不通的。

有什么办法可以关闭叠加层而无需执行以下操作:
$(".edit_button[rel]").each(function() {
$(this).overlay().close();
});

最佳答案

You can easily add more closing elements inside the overlay simply by assigning the CSS class name "close" to them. These elements can be styled and positioned any way you like inside the overlay.

If you supply a value for the close configuration variable, the close element is not auto-generated and you need to define the closing element(s) yourself.



因此,如果您输入 <a href="#" class="cancel close">Cancel</a>,它应该可以工作。

关于jquery-tools - jQuery工具: How to close an overlay?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3477217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com