开发者

how to get window width and height with YUI?

开发者 https://www.devze.com 2023-01-20 01:30 出处:网络
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 the

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

精彩评论

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

关注公众号