CSS模态窗口和iFrame

时间:2014-02-13 15:08:57

标签: css popup modal-dialog salesforce visualforce

以下CSS会在iframe中打开一个模态窗口。但我希望模态弹出窗口覆盖父级而不仅仅是在ifram中。有没有办法修改CSS以使弹出窗口覆盖父级?就像旁注一样,iFrame的id可能会改变,所以我将无法依赖特定的id。所有建议都表示赞赏,我甚至会考虑其他工具,例如javascript。

<iframe frameborder="no" height="200px" id="066E0000001KmQ9" marginheight="0"     marginwidth="0" name="066E0000001KmQ9" scrolling="no"     title="PredictiveWholesalingRelatedList" width="100%">      
<apex:page standardController="Contact" 
extensions="myExtension"  
sidebar="false" 
showHeader="false"
title="My Page">  


<apex:form >
    <apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
    <apex:pageBlock >
        This is just filler text from the Salesforce General.
    </apex:pageBlock>

    <apex:outputPanel id="tstpopup">
    <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
        <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
            This is where I would put whatever information I needed to show to my end user.<br/><br/><br/>
            <apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="tstpopup"/>
        </apex:outputPanel>
    </apex:outputPanel>

</apex:form>

<style type="text/css">
    .custPopup{
        background-color: white;
        border-width: 2px;
        border-style: solid;
        z-index: 9999;
        left: 50%;
        padding:10px;
        position: absolute;
        width: 500px;
        margin-left: -250px;
        top:100px;
    }
    .popupBackground{
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9998;
    }

</style>

我正在尝试使用此示例:http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

1 个答案:

答案 0 :(得分:1)

尝试将.custPopup更改为:

.custPopup{
    background-color: white;
    border-width: 2px;
    border-style: solid;
    z-index: 9999;
    padding:10px;
}