jQuery UI对话框()淡入淡出问题

时间:2012-04-03 15:43:40

标签: jquery jquery-ui jquery-dialog

jsFiddle:http://jsfiddle.net/loren_hibbard/ChXbr/

我正在尝试使用jQuery UI对话框,但无法弄清楚如何显示它fadeIn和关闭时fadeOut

如果我这样做......

// Dialog           
$('#dialog').dialog({
   autoOpen: false,
   width: 600,
   modal: true,
   show: 'fadeIn(300)'
});

...然后使用奇怪的jQuery效果进行模态滑动,其中所有文本内部都经常调整其格式和格式。我想要一个正常淡入淡出的内容类型顺利实现(http://www.bennadel.com/resources/presentations/jquery/demo5/index.htm)。

另外,有没有让模态覆盖更暗一些?为什么当我删除看似无关的文本段时,模态会停止工作?

2 个答案:

答案 0 :(得分:20)

试试这个:

$("#dialog").dialog({
    autoOpen: false,
    show: {
        effect: 'fade',
        duration: 2000
    },
    hide: {
        effect: 'fade',
        duration: 1000
    }
});

jsFiddle example 我的代码, jsFiddle 使用您的代码。顺便说一句,在你的例子中,你将模态设置为true和false。

答案 1 :(得分:1)

你可以尝试:

// Dialog           
$('#dialog').dialog({
   autoOpen: false,
   modal: false,
   width: 600,
   modal: true,
   show: function() {$(this).fadeIn(300);}
 });