IE6-8中的jQuery工具模态叠加显示问题

时间:2010-06-02 15:51:05

标签: jquery jquery-plugins modal-dialog jquery-tools

我正在尝试将叠加层设置为模态。它在FireFox中运行得非常好,但是当它成为模态时,窗口对象位于掩码后面。这可以防止与它的任何交互,并且页面实际上是无用的。我已经尝试了一段时间的调试,但无法弄明白。

以下是其网站上示例的链接:http://flowplayer.org/tools/demos/overlay/modal-dialog.html

$.fn.cfwindow = function(btnEvent,modal,draggable){
    //error checking
    if(btnEvent == ""){
        alert('Error in window :\n Please provide an id that instantiates the window. ');
    }   

    if(!modal && !draggable){
        $('#'+btnEvent+'[rel]').overlay();
        $('#content_overlay').css('cursor','default');
    }

    if(!modal && draggable){
        $('#'+btnEvent+'[rel]').overlay();
        $('#content_overlay').css('cursor','move');
        $('#custom').draggable();
    }

    if(modal){
        $('#'+btnEvent+'[rel]').overlay({
            // some mask tweaks suitable for modal dialogs
            mask: {
                color: '#646464',
                loadSpeed: 200,
                opacity: 0.6
            },
            closeOnClick: false
        }); 
        $('#content_overlay').css('cursor','default');
        $('#custom').addClass('modal');
    }

};

这就是我打电话时所引用的内容:

<script type="text/javascript">         
    $(document).ready(function(){
        $(document).pngFix();
        var modal = <cfoutput>#attributes.modal#;
        var drag = #attributes.draggable#;
        var btn = '#attributes.selector#';
        var src = '#attributes.source#';

        var wid = '#attributes.width#';

        $('##custom').width(parseInt(wid));

        $('div##load_content').load(src);
        $('##custom').cfwindow(btn,modal,drag,wid);
    });
</script>

模态的CSS:

<style type="text/css">
    .modal {
        display:none;
        text-align:left;                
        background-color:#FFFFFF;
        -moz-border-radius:6px;
        -webkit-border-radius:6px;

    }
</style>

排除和额外的英镑符号,IE。 “##”。

问题的屏幕截图:http://twitpic.com/1tak06

注意:IE6和IE8有同样的问题。

任何帮助都将不胜感激。

Update: HTML of the overlay/modal window:

            <div class="simple_overlay" id="custom">
                <div id="content_overlay">
                   <div id="handler">
                        <div id="headerss">
                            <h5 class="titless"><span style="color:##000000;">#attributes.title#</span></h5>
                            <div class="yellowRule"></div>
                        </div>
                        <div id="load_content">    

                        </div>              
                    </div>
                </div>
            </div>

更新:添加前端

    <!-- overlay triggers. overlay is referenced in the 'rel' attribute -->
    <p>

        <button rel="#custom" type="button" id="openWindow">Email</button>
    </p>

    <cf_eo_window2 
        title="This modal isn't working in IE!"
        selector="openWindow"
        draggable="false"
        width="350"
        modal="true"
        source="import-test.cfm" 
        />

5 个答案:

答案 0 :(得分:3)

我知道这是一个很老的问题,但我刚刚克服了IE6中的一些问题。 IE7与jQuery Tools叠加。

我的“.modal”类的div嵌套在一个具有相对位置的容器div中,所以我试图对模态类强制的z-index设置根本没有效果。

我将模态div移到任何容器之外,就我的情况而言,在关闭的body标签之前移动到页面的最底部,并且它在IE6&amp; IE7。

我确实必须将一些样式从我的容器类复制到我的模态类中,但是一个非常小的烦恼恕我直言,以获得我的客户仍然拥有大量使用IE6的网站访问者所需的结果,当然还有一个更快的解决方案而不是实现一个完全不同的jQuery插件。

答案 1 :(得分:1)

将此添加到包含叠加层的网页:

<!DOCTYPE html>

答案 2 :(得分:0)

您是否尝试过添加z-index:999;你的.modal?我假设你的div有一个模态的类名?我能看到你如何设置html吗?

答案 3 :(得分:0)

我在IE8中遇到同样的问题,使用兼容IE8而不是IE7,<!DOCTYPE html>对我不起作用。我创建了一个自定义蒙版:

#mask-modal{
position:absolute;
z-index:9000;
background-color:#fff;
display:none;
}

<div id="#mask-modal"></div>

    if (jQuery.browser.msie == true && jQuery.browser.version == 8) {
        /* Carga el overlay confirmar */
        jQuery("#modalconfirmar .modalInput").overlay({
            // Calcula el centro de la ventana
            top : ((jQuery(parent.document).height() / 2) - (jQuery("#modalconfirmar").innerHeight() + 180 )),
            closeOnClick: false,
            onBeforeLoad: function(){
                // @TODO cargar mask custom

                //Get the screen height and width
                var maskHeight = $(document).height();
                var maskWidth = $(window).width();

                //Set height and width to mask to fill up the whole screen
                $('#mask-modal').css({
                    'width':maskWidth,
                    'height':maskHeight
                });

                $('#mask-modal').fadeTo(500,0.6);
                // Load page into iframe
                jQuery(document.body).css('overflow', 'hidden');
            },
            onLoad : function(){
                jQuery("#modalconfirmar").css('z-index', jQuery("#mask-modal").css('z-index') + 10 );
            },
            onClose : function(){
                jQuery("#modalconfirmar .si").off();
                $('#mask-modal').fadeOut(400);
            }
        });}

答案 4 :(得分:0)

提示对我不起作用,为了解决问题,我只需要将ui-widget-overlay位置属性重新定义为Absolute以使用IE 8,这就是我对话框的开放功能。

$dialog.dialog( { ..... ,open: function() {$('.ui-widget-overlay').css('position', 'absolute');} ,close: function() {$('.ui-widget-overlay').css('position', 'fixed');} ....}); 希望它可以提供帮助。

相关问题