3 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
\r
4 <title>Resizable Examples</title>
\r
5 <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
\r
9 <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
\r
12 <script type="text/javascript" src="../../ext-all.js"></script>
\r
13 <script language="javascript" src="basic.js"></script>
\r
15 <!-- Common Styles for the examples -->
\r
16 <link rel="stylesheet" type="text/css" href="../shared/examples.css" />
\r
17 <style type="text/css">
\r
19 border:1px solid #c3daf9;
\r
21 font:bold 14px tahoma,verdana,helvetica;
\r
26 border:1px solid #c3daf9;
\r
35 #custom-rzwrap .x-resizable-handle{
\r
38 background:transparent url(../../resources/images/default/sizer/square.gif) no-repeat;
\r
41 #custom-rzwrap .x-resizable-handle-east, #custom-rzwrap .x-resizable-handle-west{
\r
44 #custom-rzwrap .x-resizable-handle-north, #custom-rzwrap .x-resizable-handle-south{
\r
51 <script type="text/javascript" src="../shared/examples.js"></script><!-- EXAMPLES -->
\r
52 <h1>Resizable Examples</h1>
\r
53 <p>These examples show how to apply a floating (default) and pinned Resizable component to a standard element.</p>
\r
54 <p>Note that the js is not minified so it is readable. See <a href="basic.js">basic.js</a> for the full source code.</p>
\r
57 <b>Basic Example</b><br />
\r
58 This is a basic as you get. To resize the box, position your mouse anywhere near the bottom,
\r
59 right or border right edge of the box. This example uses the default "floating" handles.
\r
61 <div id="basic">Resize Me!</div>
\r
62 <pre class="code"><code>var basic = new Ext.Resizable('basic', {
\r
70 <b>Wrapped Elements</b><br />
\r
71 Some elements such as images and textareas don't allow child elements. In the past, you had
\r
72 to wrap these elements and set up a Resizable with resize child. Resizable will
\r
73 wrap the element, calculate adjustments for borders/padding and offset the handles for you. All you have to
\r
74 do is set "wrap:true". The manual way of specifying a "resizeChild" is still supported as well.
\r
76 <b>Pinned Handles</b><br />
\r
77 Notice this example has the resize handles "pinned". This is done by setting "pinned:true".
\r
79 <b>Dynamic Sizing</b><br />
\r
80 If you don't like the proxy resizing, you can also turn on dynamic sizing. Just set "dynamic:true".
\r
83 Here's a textarea that is wrapped, has pinned handles and has dynamic sizing turned on.
\r
85 <textarea id="dwrapped">
\r
86 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa.
\r
87 Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.
\r
88 </textarea><br /><br />
\r
89 And look how simple the code is, even my grandma could write it.
\r
90 <pre class="code"><code>var dwrapped = new Ext.Resizable('dwrapped', {
\r
101 <b>Preserve Ratio</b><br />
\r
102 For some things like images, you will probably want to preserve the ratio of width to height. Just set preserveRatio:true.
\r
104 <img id="wrapped" src="sara.jpg" width="200" height="250"/>
\r
105 <pre class="code"><code>var wrapped = new Ext.Resizable('wrapped', {
\r
110 preserveRatio: true
\r
114 <b>Transparent Handles</b><br />
\r
115 If you just want the element to be resizable without any fancy handles, set transparent to true.
\r
117 <img id="transparent" src="zack.jpg" width="100" height="176"/>
\r
118 <pre class="code"><code>var transparent = new Ext.Resizable('transparent', {
\r
122 preserveRatio: true,
\r
127 <b>Customizable Handles</b><br />
\r
128 Resizable elements are resizable 8 ways. 8 way resizing for a static positioned element will cause the element to be positioned relative and taken out of the document flow. For resizing which adjusts the
\r
129 x and y of the element, the element should be positioned absolute. You can also control which handles are displayed by setting the "handles" attribute.
\r
130 The handles are styled using CSS so they can be customized to look however you would like them to.
\r
133 This image has 8 way resizing, custom handles, is draggable and 8 way preserved ratio (that wasn't easy!).<br />
\r
134 <b>Double click anywhere on the image to hide it when you are done.</b>
\r
136 <img id="custom" src="sara_and_zack.jpg" width="200" height="152" style="position:absolute;left:0;top:0;"/>
\r
137 <div style="padding:8px;border:1px solid #c3daf9;background:#d9e8fb;width:150px;text-align:center;"><button id="showMe">Show Me</button></div>
\r
138 <pre class="code"><code>var custom = new Ext.Resizable('custom', {
\r
143 preserveRatio: true,
\r
145 handles: 'all', // shorthand for 'n s e w ne nw se sw'
\r
150 <b>Snapping</b><br />
\r
151 Resizable also supports basic snapping in increments.
\r
153 <div id="snap"></div>
\r
154 <pre class="code"><code>var snap = new Ext.Resizable('snap', {
\r
164 Warning: Snapping and preserveRatio conflict and can not be used together.
\r
167 <b>Animated Transitions</b><br />
\r
168 Resize operations can also be animated. Animations support configurable easing and duration.
\r
169 Here's a very basic clone of the first element, but with animation turned on. I used a "backIn"
\r
170 easing and made it a little slower than default.
\r
172 <div id="animated">Animate Me!</div>
\r
173 <pre class="code"><code>var animated = new Ext.Resizable('animated', {
\r
182 Warning: for obvious reasons animate and dynamic resizing can not be used together.
\r