簡體   English   中英

使用prepOverlay時,如何防止打開多個疊加層?

[英]When using prepOverlay, how can multiple overlays be prevented from opening?

我正在使用Plone 4.3,我有一個browserview,其中有一些鏈接可以打開特定形式的覆蓋圖,在我的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;
        },
    });
    ...
});

不幸的是,在打開表單覆蓋圖之前,我可以多次單擊鏈接,這將導致多個打開。

如何防止打開多個覆蓋物?

在“ 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;
        }
    }        
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM