开发者

how to get window width and height with YUI?

How do I get those values? I 开发者_开发技巧see the example on the YUI page to do this but using a click event, and then calling the get('winWidth') method on the event target. But how can I get these values without the use of any event? Thanks


Simply

YAHOO.util.Dom.getViewportWidth();
YAHOO.util.Dom.getViewportHeight();

keep in mind you can reduce YUI namespace as shown bellow

(function() {
    var Yutil = YAHOO.util,

         Ydom = Ytil.Dom;

    Ydom.getViewportWidth();
    Ydom.getViewportHeight();
})();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜