如何“摇动” qooxdoo 中的窗口?

发布于 2024-08-27 18:22:12 字数 344 浏览 2 评论 0原文

我试图摇动窗口,但控制台中出现错误。我的代码:

  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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夕嗳→ 2024-09-03 18:22:12

正如您自己发现的:在您创建 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. ;-)

把梦留给海 2024-09-03 18:22:12

抱歉产生噪音!
如果我在“出现”监听器中创建效果 - 代码运行良好。

    win.addListener ("appear", function (e) 
    {
      this.effect = new qx.fx.effect.combination.Shake (
        win.getContainerElement ().getDomElement ());
    }, this);

Sorry for noise!
If I create an effect in "appear" listener - code works well.

    win.addListener ("appear", function (e) 
    {
      this.effect = new qx.fx.effect.combination.Shake (
        win.getContainerElement ().getDomElement ());
    }, this);
画▽骨i 2024-09-03 18:22:12
var win = new qx.ui.window.Window("Login");
win.setLayout(new qx.ui.layout.Grow);
win.add(view);
win.addListener("appear", function(){
  var effect = new qx.fx.effect.combination.Shake(win.getContainerElement().getDomElement());
  effect.start();
}, this);
return win;
var win = new qx.ui.window.Window("Login");
win.setLayout(new qx.ui.layout.Grow);
win.add(view);
win.addListener("appear", function(){
  var effect = new qx.fx.effect.combination.Shake(win.getContainerElement().getDomElement());
  effect.start();
}, this);
return win;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文