]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/classic/resizer/basic.html
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / classic / resizer / basic.html
CommitLineData
6527f429
DM
1<!DOCTYPE html>\r
2<html>\r
3<head>\r
4 <meta http-equiv="X-UA-Compatible" content="IE=edge">\r
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
6 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">\r
7 <title>Resizable Examples</title>\r
8\r
9 <link rel="stylesheet" type="text/css" href="../shared/examples.css" />\r
10 <link rel="stylesheet" type="text/css" href="basic.css" />\r
11\r
12 <!-- GC -->\r
13\r
14\r
15 <script type="text/javascript" src="../shared/include-ext.js"></script>\r
16 <script type="text/javascript" src="../shared/options-toolbar.js"></script>\r
17 <script src="basic.js"></script>\r
18\r
19</head>\r
20\r
21<body>\r
22\r
23<h1>Resizable Examples</h1>\r
24<p>These examples show how to apply a floating (default) and pinned Resizable component to a standard element.</p>\r
25<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
26\r
27<p>\r
28 <b>Basic Example</b><br />\r
29 This is a basic as you get. To resize the box, position your mouse anywhere near the bottom,\r
30 right or border right edge of the box. This example uses the default "floating" handles.\r
31</p>\r
32<div id="basic">Resize Me!</div>\r
33<pre class="code"><code>var basic = Ext.create('Ext.create', 'Ext.resizer.Resizer', {\r
34 target: 'basic',\r
35 width: 200,\r
36 height: 100,\r
37 minWidth:100,\r
38 minHeight:50\r
39});</code></pre>\r
40<hr>\r
41<p>\r
42 <b>Wrapped Elements</b><br />\r
43 Some elements such as images and textareas don't allow child elements. Ext JS 5.x\r
44 automatically detects if the element needs a wrap and wraps it for you.\r
45</p><p>\r
46 <b>Pinned Handles</b><br />\r
47 Notice this example has the resize handles "pinned". This is done by setting "pinned:true".\r
48</p><p>\r
49 <b>Dynamic Sizing</b><br />\r
50 If you don't like the proxy resizing, you can also turn on dynamic sizing. Just set "dynamic:true".\r
51</p>\r
52<p>\r
53 Here's a textarea that is wrapped (automatically), has pinned handles and has dynamic sizing turned on.\r
54</p>\r
55<textarea id="dwrapped" style="resize: none;">\r
56Lorem 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
57Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.\r
58</textarea><br /><br />\r
59And look how simple the code is, even my grandma could write it.\r
60<pre class="code"><code>var dwrapped = Ext.create('Ext.resizer.Resizer', {\r
61 target: 'dwrapped',\r
62 pinned:true,\r
63 width:450,\r
64 height:150,\r
65 minWidth:200,\r
66 minHeight: 50,\r
67 dynamic: true\r
68});</code></pre>\r
69<hr>\r
70<p>\r
71<b>Preserve Ratio</b><br />\r
72 For some things like images, you will probably want to preserve the ratio of width to height. Just set preserveRatio:true.\r
73</p>\r
74<img id="wrapped" src="flower.jpg" width="200" height="133"/>\r
75<pre class="code"><code>var wrapped = Ext.create('Ext.create', 'Ext.resizer.Resizer', {\r
76 target: 'wrapped',\r
77 pinned:true,\r
78 minWidth:50,\r
79 minHeight: 50,\r
80 preserveRatio: true\r
81});</code></pre>\r
82<p>\r
83<b>Snapping</b><br />\r
84 To resize in fixed increments, specify the <code>widthIncrement</code> or <code>heightIncrement</code> options. The image below\r
85 resizes (maintaining its aspect ratio) in increments of 20 pixels in both directions.\r
86</p>\r
87<img id="croix-de-fer" src="CroixDeFer.jpg" width="160" height="120"/>\r
88<pre class="code"><code>var snapping = Ext.create('Ext.resizer.Resizer', {\r
89 target: 'croix-de-fer',\r
90 width: 160,\r
91 height: 120,\r
92 minWidth: 160,\r
93 minHeight: 120,\r
94 preserveRatio: true,\r
95 heightIncrement: 20,\r
96 widthIncrement: 20\r
97});\r
98</code></pre>\r
99<hr>\r
100<p>\r
101<b>Transparent Handles</b><br />\r
102 If you just want the element to be resizable without any fancy handles, set transparent to true.\r
103</p>\r
104<img id="transparent" src="grass.jpg" width="200" height="133"/>\r
105<pre class="code"><code>var transparent = Ext.create('Ext.create', 'Ext.resizer.Resizer', {\r
106 target: 'transparent',\r
107 minWidth:50,\r
108 minHeight: 50,\r
109 preserveRatio: true,\r
110 transparent:true\r
111});</code></pre>\r
112<hr>\r
113<p>\r
114 <b>Customizable Handles</b><br />\r
115 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
116 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
117 The handles are styled using CSS so they can be customized to look however you would like them to.\r
118</p>\r
119<p>\r
120 This image has 8 way resizing, custom handles and preserved aspect ratio.<br />\r
121 <b>Double click anywhere on the image to hide it when you are done.</b>\r
122</p>\r
123<img id="custom" src="stones.jpg" width="200" height="150" style="position:absolute;left:0;top:0;"/>\r
124<div style="padding:8px;border:1px solid #c3daf9;background:#d9e8fb;width:150px;text-align:center;"><button id="showMe">Show Me</button></div>\r
125<pre class="code"><code>var custom = Ext.create('Ext.create', 'Ext.resizer.Resizer', {\r
126 target: 'custom',\r
127 pinned:true,\r
128 minWidth:50,\r
129 minHeight: 50,\r
130 preserveRatio: true,\r
131 dynamic:true,\r
132 handles: 'all' // shorthand for 'n s e w ne nw se sw'\r
133});</code></pre>\r
134\r
135<p>Images: graur codrin, Matt Banks, Lavoview (FreeDigitalPhotos.net)</p>\r
136\r
137</body>\r
138</html>\r