我使用Plone 4.3并且我有一个浏览器视图,其中我有链接打开特定表单的叠加层 在我的HTML中,我有
<table>
<thead>
<tr>
<th class='.prep_form'>Sun</th>
<th class='.prep_form'>Mon</th>
...
</tr>
</thead>
<tbody>
...
</tbody>
</table>
在我的jquery文件中
jquery(function($){
...
$('.prep_form').prepOverlay({
subtype: 'ajax',
filter: '#content-core > form',
noform: 'redirect',
redirect: function(){
redirect_location = ""; // put together a string
return redirect_location;
},
});
...
});
不幸的是,我可以在表单叠加打开之前多次单击链接,这会导致多个打开。
如何阻止打开多个叠加层?
答案 0 :(得分:2)
在Docs的jquery工具中有一个Overlay选项:oneInstance:true
但它应该是默认值。您可以通过this.getOverlay().close()
$('.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;
}
}
});