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.
You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.
Copyright © 2011 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings