YUI 3.x Home -

YUI Library Examples: Node: Measuring the Window and Document

Note: This is YUI 3.x. Looking for YUI 2.x?

Node: Measuring the Window and Document

This example shows how to measure the size of the window and document.

Window size
Click me to find out
Document size
Click me to find out

Setting up the HTML

First we need some HTML to work with.

Getting the Dimensions

In this example, we will listen for clicks on the DD elements and update them with screen information.

Adding a Click Listener

Now we just assign the click handler to the DL that will allow us to use event bubbling to handle clicks on each DD.

Full Script Source

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings