Subversion Repositories Sites.obs-saisons.fr

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
40 aurelien 1
 
2
<ul class="UIAPIPlugin-toc">
3
<li><a href="#overview">Overview</a></li>
4
<li><a href="#options">Arguments</a></li>
5
</ul>
6
<div class="UIAPIPlugin">
7
  <h1>jQuery UI Position Utility</h1>
8
  <div id="overview">
9
    <h2 class="top-header">Overview</h2>
10
    <div id="overview-main">
11
        <p>Utility script for absolutely positioning any widget relative to the window, document, a particular element, or the cursor/mouse.</p>
12
<p>Do not need ui.core.js or effects.core.js.</p>
13
    </div>
14
    <div id="overview-dependencies">
15
        <h3>Dependencies</h3>
16
        <ul>
17
<li><i>none (only jQuery core)</i></li>
18
</ul>
19
    </div>
20
    <div id="overview-example">
21
        <h3>Example</h3>
22
        <div id="overview-example" class="example">
23
<ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
24
<p><div id="demo" class="tabs-container" rel="300">
25
Clicking on the green element transfers to the other.<br />
26
</p>
27
<pre>
28
$(&quot;#position1&quot;).position({
29
  my: &quot;center&quot;,
30
  at: &quot;center&quot;,
31
  of: &quot;#targetElement&quot;
32
});
33
$(&quot;#position2&quot;).position({
34
  my: &quot;left top&quot;,
35
  at: &quot;left top&quot;,
36
  of: &quot;#targetElement&quot;
37
});
38
$(&quot;#position3&quot;).position({
39
  my: &quot;right center&quot;,
40
  at: &quot;right bottom&quot;,
41
  of: &quot;#targetElement&quot;
42
});
43
$(document).mousemove(function(ev){
44
  $(&quot;#position4&quot;).position({
45
    my: &quot;left bottom&quot;,
46
    of: ev,
47
    offset: &quot;3 -3&quot;,
48
    collision: &quot;fit&quot;
49
  });
50
});
51
 
52
</pre>
53
<p></div><div id="source" class="tabs-container">
54
</p>
55
<pre>&lt;!DOCTYPE html&gt;
56
&lt;html&gt;
57
&lt;head&gt;
58
  &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
59
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
60
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
61
  &lt;style type=&quot;text/css&quot;&gt;
62
#targetElement { width:240px;height:200px;background-color:#999;margin:30px auto; }
63
.positionDiv { width:50px;height:50px;opacity:0.6; }
64
#position1 {background-color:#F00;}
65
#position2 {background-color:#0F0;}
66
#position3 {background-color:#00F;}
67
#position4 {background-color:#FF0;}
68
&lt;/style&gt;
69
 
70
  &lt;script&gt;
71
  $(document).ready(function() {
72
 
73
$(&quot;#position1&quot;).position({
74
  my: &quot;center&quot;,
75
  at: &quot;center&quot;,
76
  of: &quot;#targetElement&quot;
77
});
78
$(&quot;#position2&quot;).position({
79
  my: &quot;left top&quot;,
80
  at: &quot;left top&quot;,
81
  of: &quot;#targetElement&quot;
82
});
83
$(&quot;#position3&quot;).position({
84
  my: &quot;right center&quot;,
85
  at: &quot;right bottom&quot;,
86
  of: &quot;#targetElement&quot;
87
});
88
$(document).mousemove(function(ev){
89
  $(&quot;#position4&quot;).position({
90
    my: &quot;left bottom&quot;,
91
    of: ev,
92
    offset: &quot;3 -3&quot;,
93
    collision: &quot;fit&quot;
94
  });
95
});
96
 
97
  });
98
  &lt;/script&gt;
99
&lt;/head&gt;
100
&lt;body style="font-size:62.5%;"&gt;
101
 
102
&lt;div id=&quot;targetElement&quot;&gt;
103
  &lt;div class=&quot;positionDiv&quot; id=&quot;position1&quot;&gt;&lt;/div&gt;
104
  &lt;div class=&quot;positionDiv&quot; id=&quot;position2&quot;&gt;&lt;/div&gt;
105
  &lt;div class=&quot;positionDiv&quot; id=&quot;position3&quot;&gt;&lt;/div&gt;
106
  &lt;div class=&quot;positionDiv&quot; id=&quot;position4&quot;&gt;&lt;/div&gt;
107
&lt;/div&gt;
108
 
109
&lt;/body&gt;
110
&lt;/html&gt;
111
</pre>
112
<p></div>
113
</p><p></div>
114
    </div>
115
  </div>
116
  <div id="options">
117
    <h2 class="top-header">Arguments</h2>
118
    <ul class="options-list">
119
 
120
<li class="option" id="option-my">
121
  <div class="option-header">
122
    <h3 class="option-name"><a href="#option-my">my</a></h3>
123
    <dl>
124
      <dt class="option-type-label">Type:</dt>
125
        <dd class="option-type">String</dd>
126
 
127
    </dl>
128
  </div>
129
  <div class="option-description">
130
    <p>Defines which position on <b>the element being positioned</b> to align with the target element: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center"</p>
131
  </div>
132
</li>
133
 
134
 
135
<li class="option" id="option-at">
136
  <div class="option-header">
137
    <h3 class="option-name"><a href="#option-at">at</a></h3>
138
    <dl>
139
      <dt class="option-type-label">Type:</dt>
140
        <dd class="option-type">String</dd>
141
 
142
    </dl>
143
  </div>
144
  <div class="option-description">
145
    <p>Defines which position on <b>the target element</b> to align the positioned element against: "horizontal vertical" alignment. A single value such as "right" will default to "right center", "top" will default to "center top" (following CSS convention). Acceptable values: "top", "center", "bottom", "left", "right". Example: "left top" or "center center"</p>
146
  </div>
147
</li>
148
 
149
 
150
<li class="option" id="option-of">
151
  <div class="option-header">
152
    <h3 class="option-name"><a href="#option-of">of</a></h3>
153
    <dl>
154
      <dt class="option-type-label">Type:</dt>
155
        <dd class="option-type">Selector</dd>
156
 
157
    </dl>
158
  </div>
159
  <div class="option-description">
160
    <p>Element to position against. You can use a browser event object contains pageX and pageY values. Example: "#top-menu"</p>
161
  </div>
162
</li>
163
 
164
 
165
<li class="option" id="option-offset">
166
  <div class="option-header">
167
    <h3 class="option-name"><a href="#option-offset">offset</a></h3>
168
    <dl>
169
      <dt class="option-type-label">Type:</dt>
170
        <dd class="option-type">String</dd>
171
 
172
    </dl>
173
  </div>
174
  <div class="option-description">
175
    <p>Add these left-top values to the calculated position, eg. "50 50" (left top) A single value such as "50" will apply to both.</p>
176
  </div>
177
</li>
178
 
179
 
180
<li class="option" id="option-collision">
181
  <div class="option-header">
182
    <h3 class="option-name"><a href="#option-collision">collision</a></h3>
183
    <dl>
184
      <dt class="option-type-label">Type:</dt>
185
        <dd class="option-type">String</dd>
186
 
187
    </dl>
188
  </div>
189
  <div class="option-description">
190
    <p>When the positioned element overflows the window in some direction, move it to an alternative position. Similar to my and at, this accepts a single value or a pair for horizontal/vertical, eg. "flip", "fit", "fit flip", "fit none".
191
</p>
192
<ul><li> <b>flip</b>: to the opposite side and the collision detection is run again to see if it will fit. If it won't fit in either position, the center option should be used as a fall back.
193
</li><li> <b>fit</b>: so the element keeps in the desired direction, but is re-positioned so it fits.
194
</li><li> <b>none</b>: not do collision detection.
195
</li></ul>
196
<p></p>
197
  </div>
198
</li>
199
 
200
 
201
<li class="option" id="option-using">
202
  <div class="option-header">
203
    <h3 class="option-name"><a href="#option-using">using</a></h3>
204
    <dl>
205
      <dt class="option-type-label">Type:</dt>
206
        <dd class="option-type">Function</dd>
207
 
208
    </dl>
209
  </div>
210
  <div class="option-description">
211
    <p>When specified the actual property setting is delegated to this callback. Receives a single parameter which is a hash of top and left values for the position that should be set.</p>
212
  </div>
213
</li>
214
 
215
    </ul>
216
  </div>
217
</div>
218
 
219
</p><!--
220
Pre-expand include size: 7094 bytes
221
Post-expand include size: 10335 bytes
222
Template argument size: 7101 bytes
223
Maximum: 2097152 bytes
224
-->
225
 
226
<!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:3784-1!1!0!!en!2 and timestamp 20100909204144 -->