Jquery 使用预覆盖时,如何防止多个覆盖层打开?
我使用的是Plone 4.3,我有一个浏览视图,其中有打开特定表单覆盖的链接 在我的html中,我有Jquery 使用预覆盖时,如何防止多个覆盖层打开?,jquery,plone,plone-4.x,Jquery,Plone,Plone 4.x,我使用的是Plone 4.3,我有一个浏览视图,其中有打开特定表单覆盖的链接 在我的html中,我有 <table> <thead> <tr> <th class='.prep_form'>Sun</th> <th class='.prep_form'>Mon</th> ... </tr>
<table>
<thead>
<tr>
<th class='.prep_form'>Sun</th>
<th class='.prep_form'>Mon</th>
...
</tr>
</thead>
<tbody>
...
</tbody>
</table>
不幸的是,在表单覆盖打开之前,我可以多次单击链接,这会导致多个打开
如何防止打开多个覆盖?在jquery工具中,是覆盖的一个选项:oneInstance:true
但它应该是默认值。您可以通过this.getOverlay().close()关闭所有打开的覆盖图
您可以测量xhr请求需要多长时间吗?在我看来,加载覆盖层需要很长时间。据firebug称,不幸的是,我需要大约半秒多一点的时间。我会记住这一点,这样用户就不会有太多的机会双击。我为我迟来的回复道歉。谢谢你的回复。这确实解决了我的问题。
jquery(function($){
...
$('.prep_form').prepOverlay({
subtype: 'ajax',
filter: '#content-core > form',
noform: 'redirect',
redirect: function(){
redirect_location = ""; // put together a string
return redirect_location;
},
});
...
});
$('.prep_form').prepOverlay({
subtype: 'ajax',
filter: '#content-core > form',
noform: 'redirect',
redirect: function(){
redirect_location = ""; // put together a string
return redirect_location;
},
config: {
oneInstance:true,
onBeforeLoad : function (e) {
console.log('onBeforeLoad', this.getOverlay());
this.getOverlay().close();
return true;
}
}
});