javascript 如何设置 ExtJS 窗口显示/隐藏动画?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16115079/
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
How to set ExtJS window show/hide with animation?
提问by scott1028
Here is My sourcecode:
这是我的源代码:
Ext.create('Ext.window.Window', { id:'edit_segtype_win', title:'msg', layout: 'fit', html:data, modal:true, resizable:false, constrain:true }).show(undefined,bind_ajax_success);
When i call show(...),the window will show without any animation. I want to add some animation,such as fadein/fadeout/slidein/slideout. Can somebody help me? Thank you!
当我调用 show(...) 时,窗口将显示没有任何动画。我想添加一些动画,例如淡入/淡出/滑入/滑出。有人可以帮助我吗?谢谢!
采纳答案by Arnaldo Ignacio Gaspar Véjar
You can use Anim object http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.fx.Animto use in your Window Component like this:
您可以使用 Anim 对象http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.fx.Anim在您的窗口组件中使用,如下所示:
var myWindow = Ext.create('Ext.window.Window', {
html:"hello world",
});
Ext.create('Ext.fx.Anim', {
target: myWindow,
duration: 1000,
from: {
width: 400, //starting width 400
opacity: 0, // Transparent
color: '#ffffff', // White
left: 0
},
to: {
width: 300, //end width 300
height: 300 // end height 300
}
});
And then, that animation is added when your call to
然后,当您调用
window.show();