Q: Using GWT 1.6.4, I have the following code to retrieve the dimensions of the browser window:

RootPanel panel = RootPanel.get();

int height = panel.getOffsetHeight(); 

int width = panel.getOffsetWidth();

Now, in the Hosted Mode browser, and in IE (but I believe the hosted mode browser uses IE, right?), this returns the correct values for both width and height. However, in FF3, width gives the correct value, but height is always zero. Can anyone explain this? Am I doing something wrong? What is the correct way to retrieve the height of the window in Firefox, and is there one method that works correctly in both IE and Firefox?

A:

Did you try the Window.getClientHeight() and Window.getClientWidth() methods?

Check out the JavaDocs.

資料來源: http://stackoverflow.com/questions/969690/gwt-firefox-getoffsetheight-always-returns-0

 

文章標籤
全站熱搜
創作者介紹
創作者 本熊 的頭像
本熊

經驗交流分享與備忘

本熊 發表在 痞客邦 留言(0) 人氣(47)