日期:2014-05-16  浏览次数:20327 次

请教如何让$.Dialog弹出后自动关闭
我查了下,都是通过 $(this).dialog("close"); 实现,关键是我不管插那个位置这句话执行了,但是不起作用.




<script>
$(function(){
$("#happytime").on('click', function(){

$.Dialog({
overlay: true,
shadow: true,
flat: true,
draggable: true,
icon: '<span class="icon-smiley fg-violet"></span>',
title: '放松一下.',
width: 275,
content: '',
onShow: function(_dialog){
var content = _dialog.children('.content');
content.html('<br>您一定能在心里感受到我的热忱.<br><br>对把.');
console.log(_dialog);

},
setTimeout(function(){
$.Dialog('close');

}, 5000);

});
 
});
});
</script>

------解决方案--------------------
脚本出错了好不

    $(function () {
        $("#happytime").on('click', function () {

            $.Dialog({
                overlay: true,
                shadow: true,
                flat: true,
                draggable: true,
                icon: '<span class="icon-smiley fg-violet"></span>',
                title: '放松一下.',
                width: 275,
                content: '',
                onShow: function (_dialog) {
                    var content = _dialog.children('.content');
                    content.html('<br>您一定能在心里感受到我的热忱.<br><br>对把.');
                    console.log(_dialog);

                }

            });
////////////
            setTimeout(function () {
                $.Dialog('close');

            }, 5000);

        });
    });

------解决方案--------------------
这是jquery ui吗?