jQuery:在模态对话框中淡出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3434051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:27:05  来源:igfitidea点击:

jQuery: fading in modal dialog

jquerydialogmodal-dialogfade

提问by Fuxi

is it possible to smoothly fadein a jquery modal dialog? (can't find anything in the docs). i've tried fadeTo but didn't help.

是否可以平滑淡入 jquery 模式对话框?(在文档中找不到任何内容)。我试过fadeTo,但没有帮助。

回答by Nick Craver

You can use the showoption(admittedly not well named, too general), like this:

您可以使用该show选项(不可否认,名字不太好,太笼统了),如下所示:

$("#dialog").dialog({ show: 'fade' });

The close animation is the matching hideoption, for example:

关闭动画是匹配hide选项,例如:

$("#dialog").dialog({ show: 'fade', hide: 'drop' });

You can give it a try here

你可以在这里试一试

回答by vivanov

You could define showand hideas objects which will give you access to more options:

您可以将show和定义hide为对象,这将使您可以访问更多选项:

$("#element").dialog({
    show: {
        effect: 'fade',
        duration: 200 //at your convenience
    },
    hide: {
        effect: 'fade',
        duration: 200 //at your convenience
    }
});