~ubuntu-branches/ubuntu/precise/whoopsie-daisy/precise-updates

« back to all changes in this revision

Viewing changes to backend/stats/static/js/yui/3.4.1/docs/resize/index.html

  • Committer: Package Import Robot
  • Author(s): Evan Dandrea
  • Date: 2012-04-18 13:04:36 UTC
  • Revision ID: package-import@ubuntu.com-20120418130436-vmt93p8fds516lws
Tags: 0.1.32
Fix failing tests on powerpc and ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Resize</title>
6
 
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
 
    <link rel="stylesheet" href="../assets/css/main.css">
8
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
 
    <script src="../../build/yui/yui-min.js"></script>
10
 
</head>
11
 
<body>
12
 
 
13
 
<div id="doc">
14
 
    <h1>Resize</h1>
15
 
 
16
 
    
17
 
        <a href="#toc" class="jump">Jump to Table of Contents</a>
18
 
    
19
 
 
20
 
    <div class="yui3-g">
21
 
        <div id="main" class="yui3-u">
22
 
            <div class="content"><div class="intro">
23
 
<p>The Resize Utility allows you to make an HTML element resizable.</p>
24
 
</div>
25
 
 
26
 
<h2 id="getting-started">Getting Started</h2>
27
 
 
28
 
<p>
29
 
To include the source files for Resize and its dependencies, first load
30
 
the YUI seed file if you haven't already loaded it.
31
 
</p>
32
 
 
33
 
<pre class="code prettyprint">&lt;script src=&quot;http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.4.1&#x2F;build&#x2F;yui&#x2F;yui-min.js&quot;&gt;&lt;&#x2F;script&gt;</pre>
34
 
 
35
 
 
36
 
<p>
37
 
Next, create a new YUI instance for your application and populate it with the
38
 
modules you need by specifying them as arguments to the <code>YUI().use()</code> method.
39
 
YUI will automatically load any dependencies required by the modules you
40
 
specify.
41
 
</p>
42
 
 
43
 
<pre class="code prettyprint">&#x2F;&#x2F; Create a new YUI instance and populate it with the required modules.
44
 
YUI().use(&#x27;resize&#x27;, &#x27;resize-plugin&#x27;, function (Y) {
45
 
    &#x2F;&#x2F; Resize is available and ready for use. Add implementation
46
 
    &#x2F;&#x2F; code here.
47
 
});</pre>
48
 
 
49
 
 
50
 
<p>
51
 
For more information on creating YUI instances and on the
52
 
<a href="http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_use"><code>use()</code> method</a>, see the
53
 
documentation for the <a href="../yui/index.html">YUI Global object</a>.
54
 
</p>
55
 
 
56
 
 
57
 
 
58
 
 
59
 
<h2 id="simple">Simple Resize</h2>
60
 
<p>You can create a simple Resize instance by including the <code>resize</code> module or <code>base-resize</code> submodule and using the following code:</p>
61
 
 
62
 
<pre class="code prettyprint">YUI().use(&#x27;resize&#x27;, function(Y) {
63
 
    var resize = new Y.Resize({
64
 
        &#x2F;&#x2F;Selector of the node to resize
65
 
        node: &#x27;#demo&#x27;
66
 
    });   
67
 
});</pre>
68
 
 
69
 
 
70
 
<h2 id="events">Events</h2>
71
 
 
72
 
<p>Resize provides useful events to allow the implementer to control the end-user experience.</p>
73
 
                                
74
 
<table>
75
 
    <thead>
76
 
        <tr>
77
 
            <th>Event</th>
78
 
            <th>Preventable</th>
79
 
            <th>Stoppable</th>
80
 
            <th>Bubbles</th>
81
 
            <th>Description</th>
82
 
        </tr>
83
 
    </thead>
84
 
    <tbody>
85
 
        <tr>
86
 
            <td><code>resize:start</code></td>
87
 
            <td>yes</td>
88
 
            <td>yes</td>
89
 
            <td>yes</td>
90
 
            <td>Handles the resize start event. Fired when the user begins dragging a handle.</td>
91
 
        </tr>
92
 
        <tr>
93
 
            <td><code>resize:resize</code></td>
94
 
            <td>yes</td>
95
 
            <td>yes</td>
96
 
            <td>yes</td>
97
 
            <td>Handles the resize event. Fired with every native <code>mousemove</code> event when the handle is being dragged; this could be as often as once for every pixel of movement.</td>
98
 
        </tr>
99
 
        <tr>
100
 
            <td><code>resize:align</code></td>
101
 
            <td>yes</td>
102
 
            <td>yes</td>
103
 
            <td>yes</td>
104
 
            <td>Handles the resize align event.</td>
105
 
        </tr>
106
 
        <tr>
107
 
            <td><code>resize:end</code></td>
108
 
            <td>yes</td>
109
 
            <td>yes</td>
110
 
            <td>yes</td>
111
 
            <td>Handles the resize end event. Fired when the user releases the handle from the drag operation.</td>
112
 
        </tr>
113
 
        <tr>
114
 
            <td><code>resize:mouseUp</code></td>
115
 
            <td>yes</td>
116
 
            <td>yes</td>
117
 
            <td>yes</td>
118
 
            <td>Handles the resize <code>mouseup</code> event. Fired when a <code>mouseup</code> event happens on a handle.</td>
119
 
        </tr>
120
 
    </tbody>
121
 
</table>
122
 
 
123
 
<h2 id="modules">Module Descriptions</h2>
124
 
 
125
 
<p>Resize for YUI 3 has been broken up into several modules to allow you, as the implementer, to target the specific functionality you want — and omit the functionality you're not using.</p>
126
 
<table>
127
 
    <thead>
128
 
        <tr>
129
 
            <th>Module Name</th>
130
 
            <th>Description</th>
131
 
        </tr>
132
 
    </thead>
133
 
    <tbody>
134
 
        <tr>
135
 
            <td nowrap="nowrap"><code>resize-base</code></td>
136
 
            <td>This is the base Resize class; use this submodule for your simplest use case, where constraints, ratios, and proxies are not required.</td>
137
 
        </tr>
138
 
        <tr>
139
 
            <td nowrap="nowrap"><code>resize-constrain</code></td>
140
 
            <td>Adds constraining &amp; ratio support.</td>
141
 
        </tr>
142
 
        <tr>
143
 
            <td nowrap="nowrap"><code>resize-proxy</code></td>
144
 
            <td>Adds proxy support, via <code>dd-proxy</code>.</td>
145
 
        </tr>
146
 
    </tbody>
147
 
</table>
148
 
 
149
 
<h2 id="resize-plugins">Resize Plugin for Widgets</h2>
150
 
 
151
 
<p>Along with the standalone utility, a Resize plugin is available and can be plugged into Y.Node or Y.Widget instances. The plugin can be created by adding <code>resize-plugin</code> in your use statement, and then plugging in <code>Y.Plugin.Resize</code>.</p>
152
 
 
153
 
<pre class="code prettyprint">YUI().use(&#x27;overlay&#x27;, &#x27;resize-plugin&#x27;, function(Y) {
154
 
    var overlay = new Y.Overlay({
155
 
       width: &quot;200px&quot;,
156
 
       height: &quot;300px&quot;,
157
 
       srcNode: &quot;#overlay&quot;,
158
 
       visible: &quot;true&quot;,
159
 
       centered: &quot;true&quot; 
160
 
    });
161
 
    &#x2F;&#x2F;Plug in the resizability plugin
162
 
    overlay.plug(Y.Plugin.Resize);
163
 
    overlay.render();
164
 
});</pre>
165
 
 
166
 
<h3 id="listening-to-events-on-a-widget">Listening to events on a widget</h3>
167
 
<p>With the resize plugin being plugged into a Y.Widget instance, resize events can be listened to under the <code>resize</code> namespace. The resize plugin will automatically change <code>width</code> and <code>height</code> attributes on the widget (and the <code>x</code> , <code>y</code> attributes if your widget uses <code>Y.WidgetPosition</code>).</p>
168
 
 
169
 
<pre class="code prettyprint">YUI().use(&#x27;overlay&#x27;, &#x27;resize-plugin&#x27;, function(Y) {
170
 
    overlay.plug(Y.Plugin.Resize);
171
 
    overlay.render();
172
 
 
173
 
    overlay.resize.on(&#x27;resize:resize&#x27;, function(event) {
174
 
       &#x2F;&#x2F;this function will be called on resize. 
175
 
    });
176
 
});</pre>
177
 
 
178
 
 
179
 
</div>
180
 
        </div>
181
 
 
182
 
        <div id="sidebar" class="yui3-u">
183
 
            
184
 
                <div id="toc" class="sidebox">
185
 
                    <div class="hd">
186
 
                        <h2 class="no-toc">Table of Contents</h2>
187
 
                    </div>
188
 
 
189
 
                    <div class="bd">
190
 
                        <ul class="toc">
191
 
<li>
192
 
<a href="#getting-started">Getting Started</a>
193
 
</li>
194
 
<li>
195
 
<a href="#simple">Simple Resize</a>
196
 
</li>
197
 
<li>
198
 
<a href="#events">Events</a>
199
 
</li>
200
 
<li>
201
 
<a href="#modules">Module Descriptions</a>
202
 
</li>
203
 
<li>
204
 
<a href="#resize-plugins">Resize Plugin for Widgets</a>
205
 
<ul class="toc">
206
 
<li>
207
 
<a href="#listening-to-events-on-a-widget">Listening to events on a widget</a>
208
 
</li>
209
 
</ul>
210
 
</li>
211
 
</ul>
212
 
                    </div>
213
 
                </div>
214
 
            
215
 
 
216
 
            
217
 
                <div class="sidebox">
218
 
                    <div class="hd">
219
 
                        <h2 class="no-toc">Examples</h2>
220
 
                    </div>
221
 
 
222
 
                    <div class="bd">
223
 
                        <ul class="examples">
224
 
                            
225
 
                                
226
 
                                    <li data-description="Resize a node.">
227
 
                                        <a href="simple-resize.html">Simple Resize</a>
228
 
                                    </li>
229
 
                                
230
 
                            
231
 
                                
232
 
                                    <li data-description="A simple resize implementation that utilizes the ResizeConstrained plugin to set min/max dimensions and to lock in the resized element&#x27;s aspect ratio.">
233
 
                                        <a href="constrain-resize.html">Constrain a Resize</a>
234
 
                                    </li>
235
 
                                
236
 
                            
237
 
                                
238
 
                                    <li data-description="This example shows an 8-way image resize, providing the CSS needed for a common image-resize visual treatment.">
239
 
                                        <a href="image-resize.html">8-way Image Resize</a>
240
 
                                    </li>
241
 
                                
242
 
                            
243
 
                                
244
 
                                    <li data-description="Plugs a widget with resize functionality.">
245
 
                                        <a href="simple-resize-plugin.html">Widget with simple Resize Plugin</a>
246
 
                                    </li>
247
 
                                
248
 
                            
249
 
                                
250
 
                                    <li data-description="Plugs a widget with resize functionality, and implements ResizeConstrained">
251
 
                                        <a href="constrain-resize-plugin.html">Widget with Resize Plugin under constraints</a>
252
 
                                    </li>
253
 
                                
254
 
                            
255
 
                        </ul>
256
 
                    </div>
257
 
                </div>
258
 
            
259
 
 
260
 
            
261
 
        </div>
262
 
    </div>
263
 
</div>
264
 
 
265
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
266
 
<script>prettyPrint();</script>
267
 
 
268
 
</body>
269
 
</html>