YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

YUI Library Examples: Layout Manager: Layout inside a resizable Panel

Layout Manager: Layout inside a resizable Panel

This example shows how to build a layout inside of a resizable Panel Control.

Create the Panel

First we must create the panel instance, like this:

Now let's give it some content. Note that we are adding a DIV to the body with an id of layout. This will be the element we anchor the layout to.

Adding the Layout instance

Now we need to listen for the beforeRender event to render our Layout.

Inside of the beforeRender event, we will wait for the element layout to appear in the document, then we will setup our Layout instance.

The layout instance we are creating will have top, left, bottom and center units configured below:

Now we have a layout inside of a Panel.

Make the Panel resizable

After we have rendered our panel, we can attach the Resize Utility to it like this:

Now give the resize handle a little CSS to make it look nicer.

This will place a handle at the bottom right corner of the panel. This will only resize the outside portion of the panel, but we want the inside to resize properly.

Now we need to listen for the resize event on the Resize instance and do a little math.

Now we have the Panel resizing the way we want, but the layout is not resizing to match. Inside the resize event from the Resize instance we need to add this at the bottom:

Now we have a resizable panel with a fixed layout inside.

Full Example Source

Copyright © 2013 Yahoo! Inc. All rights reserved.

Privacy Policy - Copyright Policy - Job Openings