从 Markup 中构建

Class

从 Markup 中构建

加入初始样式

<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>

Note

初始 srcNode 不能设置为 display:none ,需要设置为 position:absolute;left:-9999px;top:-9999px;

KISSY.use('node, overlay, button', function(S, Node, O, Button) {
    //通过dom元素新建立popup
    window.popup = new O.Popup({
        srcNode:'#dpop',
        trigger : '#img-download',//配置Popup的触发器
        triggerType : 'mouse',    //触发类型
        align : {
            node : '#img-download',
            points : ['tc', 'bc'],
            offset : [0, 50]
        }
    });

    var b = new Button({
        content: "销毁",

        render: "#button-wrap"
    });
    b.render();
    b.on("click", function() {
        //调用外部接口销毁popup
        window.popup.destroy();
    });
});