zoukankan      html  css  js  c++  java
  • jquery.jconfirm兼容IE6

    因目标用户还在大量使用IE6(想吐CAO),只能做向下兼容,但之前使用的这个插件在IE6上并不支持。所以做了些处理才行。

    以下为解决方法:

    IE6不支持position: fixed,所以需要对CSS进行HACK

    修改如下:

    .jconfirm {
        position: fixed;
        /*hack ie6*/
        _position: absolute;
        _display: block;
        _width: 100%;
    
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 99999999;
        font-family: inherit;
        overflow: hidden;
    }
    
        .jconfirm .jconfirm-bg {
            position: fixed;
             /*hack ie6*/
           _position: absolute;
            _display: block;
            _width: 100%;
    
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            opacity: 0;
            filter: alpha(opacity:0);
            -webkit-transition: all .4s;
            transition: all .4s;
        }
    
            .jconfirm .jconfirm-bg.seen {
                opacity: 1;
                filter: alpha(opacity:100);
            }
    
        .jconfirm .jconfirm-scrollpane {
            position: fixed;
            /*hack ie6*/
             _position: absolute;
            _display: block;
            _width: 100%;
    
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            overflow-y: auto;
        }

    另外,样式中,所有opacity:x,都添加一行filter: alpha(opacity:y);其中的值y=x*100;

    然后JS也需要做些更改,需要计算高度。

            setBKHeight: function () {
                if ($.browser.msie && $.browser.version < 8) {
                    var windowHeight = $(window).height();
                    $(".jconfirm").height(windowHeight);
                    $(".jconfirm-bg").height(windowHeight);
                    $(".jconfirm-scrollpane").height(windowHeight);
                }
            },

    在resize事件中添加计算高度

    $(window).on('resize.' + this._rand, function () {
                    that.setDialogCenter(true);
                    that.setBKHeight();
                });

    _buildHTML中也需要添加调用:

                if (this.closeIcon === true) {
                    this.$closeButton = this.$b.find('.closeIcon').show();
                }

                this.setContent();
                this.setBKHeight();

    这样就可以了。

    http://files.cnblogs.com/files/dengxi/jquery.jconfirm.7z
    嫌麻烦的,可以直接下载.

  • 相关阅读:
    11.文件操作
    10.模块和包
    9.异常
    8.单例模式
    7.类属性、类方法、静态方法
    小学口算题卡---田青正
    个人技术流程(四则运算)--马伟杰
    个人开发流程(四则运算)--张文龙
    个人技术流程(四则运算)--王潮玉
    个人技术流程(四则运算)--毛明明
  • 原文地址:https://www.cnblogs.com/dengxi/p/7196458.html
Copyright © 2011-2022 走看看