Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get window width and height with YUI?

Tags:

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

like image 743
Ricardo Avatar asked Oct 16 '10 10:10

Ricardo


1 Answers

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();
})();
like image 66
Arthur Ronald Avatar answered Sep 25 '22 18:09

Arthur Ronald