This example shows how to make an element resizable by all 8 handles.
We are going to make the element
#yui_img resizable in all 8 directions.
Note: When you want to resize an element that requires the top and left sides to be positioned, it is best practice to make the element
Otherwise it will be positioned relative and the outcome will not be what you expected.
Since an image cannot have child nodes appended to it, the Resize Utility will auto wrap it with an element that can. See the API docs for more info on the wrap option.
For shorthand, we are using the
handles type of
All, which just simply means
t, r, b, l, tr, tl, br, bl. We are also using the config
knobHandles, this applies a class to the Resize element and styles all of the handles into the small knobs seen above.
In this instance we have also turned on the convenience option
draggable, this will allow the element to be dragged.
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.