有什么方法可以获取GWT中小部件的position属性的值吗?
我已经尝试过了,widget.getElement.getStyle().getPosition()
但是它总是返回一个空字符串。
谢谢
您可以编写使用的本机方法document.defaultView.getComputedStyle
。
public static native String getComputedPosition(Element element) /*-{
return document.defaultView.getComputedStyle(element, null)["position"];
}-*/;
这适用于大多数现代浏览器。参考:http : //www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-OverrideAndComputed
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句