如何“摇动” qooxdoo 中的窗口?
我试图摇动窗口,但控制台中出现错误。我的代码:
var win = new qx.ui.window.Window ("Login");
win.setLayout (new qx.ui.layout.Grow);
win.add (view);
this.effect = new qx.fx.effect.combination.Shake (
win.getContainerElement ().getDomElement ());
return win;
其中 view 是 GroupBox 实例(来自 demobrowser/animation/login)。
I'm trying to shake a window, but got error mess in console. My code:
var win = new qx.ui.window.Window ("Login");
win.setLayout (new qx.ui.layout.Grow);
win.add (view);
this.effect = new qx.fx.effect.combination.Shake (
win.getContainerElement ().getDomElement ());
return win;
Where view is a GroupBox instance (from demobrowser/animation/login).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如您自己发现的:在您创建 shake 对象时,窗口的 DOM 元素并不存在。在 qooxdoo 中,我们一次性创建所有 DOM 元素,这样浏览器就不必频繁渲染。
当窗口触发“appear”事件(您也可以使用“resize”事件)时,DOM 元素已被创建。请务必使用 addListenerOnce() 而不是 addListener()!否则,每次窗口再次可见时(如果它已被隐藏),您都会创建一个新的抖动效果。 ;-)
As you have found out by yourself: the DOM element of the window is not there at the moment you create the shake object. In qooxdoo we create all DOM elements at once, so that the browser don't have to render more often than needed.
At the time window fires the "appear" event (you could also use the "resize" event), the DOM element has been created. Be sure to use addListenerOnce() instead of addListener()! Otherwise you will create a new shake effect every time the window gets visible again, if it has been hidden. ;-)
抱歉产生噪音!
如果我在“出现”监听器中创建效果 - 代码运行良好。
Sorry for noise!
If I create an effect in "appear" listener - code works well.