使用对话可以同时产生多重效果吗?例如,在节目中,反弹并突出显示。

我尝试了{effect: 'bounce', duration: 550, effect: 'highlight', duration: 550},,但仅运行最后一个效果。

$('.modal').click(function () {
    $(".dialog-modal").dialog({
        modal: true,
        hide: "fadeOut",
        show: {effect: 'bounce', duration: 550, effect: 'highlight', duration: 550},
        buttons: {
            Ok: function () {
                $(this).dialog("close");
            }
        }
    });
});

最佳答案

我在此上花费的时间很有意义。而且我仍然没有得到想要的结果。

但这至少应该对您有所帮助。 Check da fiddle

jQueryUI:

$(document).ready(function () {
    var $dlg = $('.dialog-modal');
    var $mdl = $('.modal');
    $dlg.dialog({
        autoOpen: false,
        modal: true,
        dialogClass: 'sweetums',
        hide: "fadeOut",
        show: {
            effect: 'bounce',
            duration: 550
        },
        buttons: {
            Ok: function () {
                $dlg.dialog("close");
            }
        }
    });
    var $newDialog = $('.sweetums');
    $mdl.click(function () {
        $dlg.dialog('open');
        $newDialog.effect("highlight", 550);
    });
});


HTML:

<button class="modal">Click</button>
<div class="dialog-modal">some stuff</div>


如果您想知道为什么我为$newDialog创建了第二个对象,那是因为旧的对象最初是div和text,但是在创建模态时,它将展开并添加按钮。 $dlg仅会影响文本本身,而不会影响整个框,因此必须将整个内容包装起来。

07-24 09:38
查看更多