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.
This example shows how to build a layout inside of a resizable Panel Control.
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.
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.
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.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.