【问题标题】:Element does not responding to setStyle元素不响应 setStyle
【发布时间】:2013-10-15 09:27:50
【问题描述】:

我正在尝试移动小部件中的 qx.html.Element。 所以我创建了一个监听器来捕捉鼠标,并创建一个监听器来捕捉鼠标移动等。 qooxdoo中的代码playground

但是当我尝试例如 setStyle("top","30px") 时会发生一件奇怪的事情 getStyle("top") 返回"30px" 但该元素似乎没有响应更改。

我尝试使用qx.html.Element.flush(),但没有任何变化。

但是当我尝试调整元素 ( setStyle("height","20px")) 的大小时,此更改工作正常(例如在评论部分)

我在这里缺少什么?

为什么调整大小(注释)部分的 setStyle 有效,而移动部分的 setStyle 无效?

【问题讨论】:

    标签: javascript html css qooxdoo


    【解决方案1】:

    最简单的解释是元素有position:statictopleftrightbottom 值仅在元素的位置不是 staticrelativeabsolutefixed)时才会影响元素。

    但请注意,更改 position 属性的值可能会对小部件的布局和整个应用程序产生重要影响。

    【讨论】:

    • 使用 new qx.html.Element("div",{"position":"relative", "background-color":"green", "height":"20px", 初始化元素“宽度”:“20px”,“顶部”:“0px”});做的伎俩。 :>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-02
    • 1970-01-01
    • 2013-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多