对话框 fixed 居中

Class

对话框 fixed 居中

加入初始样式

<style>
    .ks-overlay {
        position:absolute;
        left:-9999px;
        top:-9999px;
    }
    .ks-overlay-hidden {
        visibility: hidden;
    }

    .ks-overlay-mask-hidden {
        display: none;
    }

    .ks-overlay-shown {
        visibility: visible;
    }

    .ks-overlay-mask-shown{
        display: block;
    }
</style>
KISSY.use("ua,event,node,overlay,button,component/plugin/drag", function (S, UA, Event, Node, O, B, DragPlugin) {
    var dialog = new O({
        width: 424,
        elCls: 'my',
        content: '<img '
            + 'width="424" '
            + 'height="282" '
            + 'src="http://img02.taobaocdn.com/tps/i2/T10J9bXnlgXXXXXXXX-424-282.jpg?noq=y" />',
        closable: 1,
        mask:true,
        align: {
            points: ['cc', 'cc']
        },
        closeAction: "destroy"
    });

    var b1 = new B({
        content: "我在可视区域的正中间,点击关闭销毁",

        render: "#button-wrap"
    });
    b1.render();

    dialog.on("destroy", function () {
        b1.detach("click", show);
        Event.detach(window, "scroll", center);
    });

    b1.on('click', show);

    function show() {
        dialog.show();
    }

    function center() {
        alert("ie center");
        if (dialog.get("visible")) {
            dialog.center();
        }
    }

    if (UA.ie == 6) {
        Event.on(window, "scroll", center);
    }
});