Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 aperonnet 1
<html>
2
<head>
3
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
4
<title>Resizable Examples</title>
5
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
6
 
7
   <!-- GC -->
8
 	<!-- LIBS -->
9
 	<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
10
 	<!-- ENDLIBS -->
11
 
12
    <script type="text/javascript" src="../../ext-all.js"></script>
13
<script language="javascript" src="basic.js"></script>
14
 
15
<!-- Common Styles for the examples -->
16
<link rel="stylesheet" type="text/css" href="../examples.css" />
17
<style type="text/css">
18
#basic, #animated {
19
    border:1px solid #c3daf9;
20
    color:#1e4e8f;
21
    font:bold 14px tahoma,verdana,helvetica;
22
    text-align:center;
23
    padding-top:20px;
24
}
25
#snap {
26
    border:1px solid #c3daf9;
27
    overflow:hidden;
28
}
29
#custom {
30
    cursor:move;
31
}
32
#custom-rzwrap{
33
    z-index: 100;
34
}
35
#custom-rzwrap .x-resizable-handle{
36
    width:11px;
37
    height:11px;
38
    background:transparent url(../../resources/images/default/sizer/square.gif) no-repeat;
39
    margin:0px;
40
}
41
#custom-rzwrap .x-resizable-handle-east, #custom-rzwrap .x-resizable-handle-west{
42
    top:45%;
43
}
44
#custom-rzwrap .x-resizable-handle-north, #custom-rzwrap .x-resizable-handle-south{
45
    left:45%;
46
}
47
</style>
48
</head>
49
 
50
<body>
51
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
52
<h1>Resizable Examples</h1>
53
<p>These examples show how to apply a floating (default) and pinned Resizable component to a standard element.</p>
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>
55
 
56
<p>
57
    <b>Basic Example</b><br />
58
    This is a basic as you get. To resize the box, position your mouse anywhere near the bottom,
59
    right or border right edge of the box. This example uses the default "floating" handles.
60
</p>
61
<div id="basic">Resize Me!</div>
62
<pre class="code"><code>var basic = new Ext.Resizable('basic', {
63
        width: 200,
64
        height: 100,
65
        minWidth:100,
66
        minHeight:50
67
});</code></pre>
68
<hr>
69
<p>
70
    <b>Wrapped Elements</b><br />
71
    Some elements such as images and textareas don't allow child elements. In the past, you had
72
    to wrap these elements and set up a Resizable with resize child. Resizable will
73
    wrap the element, calculate adjustments for borders/padding and offset the handles for you. All you have to
74
    do is set "wrap:true". The manual way of specifying a "resizeChild" is still supported as well.
75
</p><p>
76
    <b>Pinned Handles</b><br />
77
    Notice this example has the resize handles "pinned". This is done by setting "pinned:true".
78
</p><p>
79
    <b>Dynamic Sizing</b><br />
80
    If you don't like the proxy resizing, you can also turn on dynamic sizing. Just set "dynamic:true".
81
</p>
82
<p>
83
    Here's a textarea that is wrapped, has pinned handles and has dynamic sizing turned on.
84
</p>
85
<textarea id="dwrapped">
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.
87
Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.
88
</textarea><br /><br />
89
And look how simple the code is, even my grandma could write it.
90
<pre class="code"><code>var dwrapped = new Ext.Resizable('dwrapped', {
91
    wrap:true,
92
    pinned:true,
93
    width:450,
94
    height:150,
95
    minWidth:200,
96
    minHeight: 50,
97
    dynamic: true
98
});</code></pre>
99
<hr>
100
<p>
101
<b>Preserve Ratio</b><br />
102
    For some things like images, you will probably want to preserve the ratio of width to height. Just set preserveRatio:true.
103
</p>
104
<img id="wrapped" src="sara.jpg" width="200" height="250"/>
105
<pre class="code"><code>var wrapped = new Ext.Resizable('wrapped', {
106
    wrap:true,
107
    pinned:true,
108
    minWidth:50,
109
    minHeight: 50,
110
    preserveRatio: true
111
});</code></pre>
112
<hr>
113
<p>
114
<b>Transparent Handles</b><br />
115
    If you just want the element to be resizable without any fancy handles, set transparent to true.
116
</p>
117
<img id="transparent" src="zack.jpg" width="100" height="176"/>
118
<pre class="code"><code>var transparent = new Ext.Resizable('transparent', {
119
    wrap:true,
120
    minWidth:50,
121
    minHeight: 50,
122
    preserveRatio: true,
123
    transparent:true
124
});</code></pre>
125
<hr>
126
<p>
127
    <b>Customizable Handles</b><br />
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
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.
130
    The handles are styled using CSS so they can be customized to look however you would like them to.
131
</p>
132
<p>
133
    This image has 8 way resizing, custom handles, is draggable and 8 way preserved ratio (that wasn't easy!).<br />
134
    <b>Double click anywhere on the image to hide it when you are done.</b>
135
</p>
136
<img id="custom" src="sara_and_zack.jpg" width="200" height="152" style="position:absolute;left:0;top:0;"/>
137
<div style="padding:8px;border:1px solid #c3daf9;background:#d9e8fb;width:150px;text-align:center;"><button id="showMe">Show Me</button></div>
138
<pre class="code"><code>var custom = new Ext.Resizable('custom', {
139
    wrap:true,
140
    pinned:true,
141
    minWidth:50,
142
    minHeight: 50,
143
    preserveRatio: true,
144
    dynamic:true,
145
    handles: 'all', // shorthand for 'n s e w ne nw se sw'
146
    draggable:true
147
});</code></pre>
148
<hr>
149
<p>
150
    <b>Snapping</b><br />
151
    Resizable also supports basic snapping in increments.
152
</p>
153
<div id="snap"></div>
154
<pre class="code"><code>var snap = new Ext.Resizable('snap', {
155
    pinned:true,
156
    width:250,
157
    height:100,
158
    handles: 'e',
159
    widthIncrement:50,
160
    minWidth: 50,
161
    dynamic: true
162
});
163
</code></pre>
164
Warning: Snapping and preserveRatio conflict and can not be used together.
165
<hr>
166
<p>
167
    <b>Animated Transitions</b><br />
168
    Resize operations can also be animated. Animations support configurable easing and duration.
169
    Here's a very basic clone of the first element, but with animation turned on. I used a "backIn"
170
    easing and made it a little slower than default.
171
</p>
172
<div id="animated">Animate Me!</div>
173
<pre class="code"><code>var animated = new Ext.Resizable('animated', {
174
    width: 200,
175
    height: 100,
176
    minWidth:100,
177
    minHeight:50,
178
    animate:true,
179
    easing: 'backIn',
180
    duration:.6
181
});</code></pre>
182
Warning: for obvious reasons animate and dynamic resizing can not be used together.
183
</body>
184
</html>