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
jQuery: fading in modal dialog
提问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 show
option(admittedly not well named, too general), like this:
您可以使用该show
选项(不可否认,名字不太好,太笼统了),如下所示:
$("#dialog").dialog({ show: 'fade' });
The close animation is the matching hide
option, for example:
关闭动画是匹配hide
选项,例如:
$("#dialog").dialog({ show: 'fade', hide: 'drop' });
回答by vivanov
You could define show
and hide
as 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
}
});