|
1 | 1 | <!doctype html>
|
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 |
| - <meta charset="utf-8"> |
5 |
| - <title>Position Visual Test: Containing Element</title> |
6 |
| - |
7 |
| - <link rel="stylesheet" href="../visual.css" type="text/css" /> |
8 |
| - <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" /> |
9 |
| - |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>Position Visual Test</title> |
10 | 6 | <script src="../../../jquery-1.7.2.js"></script>
|
11 | 7 | <script src="../../../ui/jquery.ui.core.js"></script>
|
12 | 8 | <script src="../../../ui/jquery.ui.widget.js"></script>
|
13 | 9 | <script src="../../../ui/jquery.ui.mouse.js"></script>
|
14 | 10 | <script src="../../../ui/jquery.ui.draggable.js"></script>
|
15 | 11 | <script src="../../../ui/jquery.ui.position.js"></script>
|
16 |
| - |
17 | 12 | <style>
|
18 |
| - html, body { |
19 |
| - height:100%; |
20 |
| - width:100%; |
21 |
| - margin:0; |
22 |
| - /* force scroll bar*/ |
23 |
| - min-height:800px; |
24 |
| - min-width:800px; |
25 |
| - |
26 |
| - /* IE6 needs this */ |
27 |
| - text-align:center; |
28 |
| - } |
29 |
| - .demo-description { |
30 |
| - text-align:center; |
31 |
| - padding:1.5em; |
32 |
| - } |
33 |
| - .demo-container { |
34 |
| - background:#aaa; |
35 |
| - width:80%; |
36 |
| - height:80%; |
37 |
| - |
38 |
| - text-align:left; |
39 |
| - margin:0 auto; |
40 |
| - position:relative; |
41 |
| - padding:10px; |
42 |
| - } |
43 |
| - .demo { |
44 |
| - background:#eee; |
45 |
| - overflow:hidden; |
46 |
| - position:relative; |
47 |
| - height:100%; |
48 |
| - /* IE6 needs this */ |
49 |
| - width:100%; |
50 |
| - } |
51 |
| - #parent { |
52 |
| - width: 60%; |
53 |
| - margin: 10px auto; |
54 |
| - padding: 5px; |
55 |
| - border: 1px solid #777; |
56 |
| - background-color: #fbca93; |
57 |
| - text-align: center; |
58 |
| - cursor:move; |
59 |
| - } |
60 |
| - .positionable { |
61 |
| - width: 75px; |
62 |
| - height: 75px; |
63 |
| - position: absolute; |
64 |
| - display: block; |
65 |
| - right: 0; |
66 |
| - bottom: 0; |
67 |
| - background-color: #bcd5e6; |
68 |
| - text-align: center; |
69 |
| - cursor:move; |
70 |
| - } |
71 |
| - .ui-flipped-top { |
72 |
| - border-top: 3px solid #000000; |
| 13 | + .demo { |
| 14 | + position: relative; |
| 15 | + height: 500px; |
| 16 | + width: 80%; |
| 17 | + margin: 20px auto; |
| 18 | + background: #eee; |
73 | 19 | }
|
74 |
| - .ui-flipped-bottom { |
75 |
| - border-bottom: 3px solid #000000; |
| 20 | + #target { |
| 21 | + width: 60%; |
| 22 | + margin: 0 auto; |
| 23 | + border: 1px solid #777; |
| 24 | + background-color: #fbca93; |
| 25 | + text-align: center; |
| 26 | + cursor: move; |
76 | 27 | }
|
77 |
| - .ui-flipped-left { |
78 |
| - border-left: 3px solid #000000; |
| 28 | + .positionable { |
| 29 | + position: absolute; |
| 30 | + background-color: #bcd5e6; |
| 31 | + text-align: center; |
79 | 32 | }
|
80 |
| - .ui-flipped-right { |
81 |
| - border-right: 3px solid #000000; |
| 33 | + .extra-margin { |
| 34 | + margin: 0 15px 15px 0; |
82 | 35 | }
|
83 |
| - select, input { |
84 |
| - margin-left: 15px; |
85 |
| - } |
86 |
| - .extra-margin { |
87 |
| - margin: 0 15px 15px 0; |
88 |
| - } |
89 | 36 | </style>
|
90 | 37 | <script>
|
91 |
| - $(function() { |
92 |
| - var within = $( ".demo" ), |
93 |
| - positionable = $( ".positionable" ); |
94 |
| - function position() { |
95 |
| - positionable.position({ |
96 |
| - of: $( "#parent" ), |
97 |
| - my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(), |
98 |
| - at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(), |
99 |
| - offset: $( "#offset" ).val(), |
100 |
| - within: within, |
101 |
| - collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val() |
102 |
| - }); |
103 |
| - } |
104 |
| - $( ".demo" ).css("overflow","scroll"); |
105 |
| - |
106 |
| - positionable.css( "opacity", 0.5 ); |
107 |
| - |
108 |
| - |
109 |
| - $( "#parent" ).draggable({ |
110 |
| - drag: function() { position(); } |
111 |
| - }); |
112 |
| - |
113 |
| - $("#within").click(function() { |
114 |
| - within = within.is(".demo") ? $(window) : $(".demo"); |
115 |
| - position(); |
116 |
| - }); |
117 |
| - |
118 |
| - $("#margin").click(function() { |
119 |
| - positionable.toggleClass( "extra-margin" ); |
120 |
| - position(); |
121 |
| - }); |
122 |
| - |
123 |
| - $( ":input" ).bind( "click keyup change", function() { position(); } ); |
124 |
| - |
125 |
| - position(); |
126 |
| - }); |
| 38 | + $(function() { |
| 39 | + var within = $( ".demo" ), |
| 40 | + positionable = $( ".positionable" ); |
| 41 | + function position() { |
| 42 | + positionable.position({ |
| 43 | + of: $( "#target" ), |
| 44 | + my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(), |
| 45 | + at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(), |
| 46 | + within: within, |
| 47 | + collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val() |
| 48 | + }); |
| 49 | + } |
| 50 | + |
| 51 | + positionable.css( "opacity", 0.5 ); |
| 52 | + |
| 53 | + $( "#target" ).draggable({ |
| 54 | + drag: function() { position(); } |
| 55 | + }); |
| 56 | + |
| 57 | + $( "#within" ).click(function() { |
| 58 | + within = within.is( ".demo" ) ? $( window ) : $( ".demo" ); |
| 59 | + position(); |
| 60 | + }); |
| 61 | + |
| 62 | + $( "#margin" ).click(function() { |
| 63 | + positionable.toggleClass( "extra-margin" ); |
| 64 | + position(); |
| 65 | + }); |
| 66 | + |
| 67 | + $( ":input" ).bind( "click keyup change", function() { position(); } ); |
| 68 | + |
| 69 | + position(); |
| 70 | + }); |
127 | 71 | </script>
|
128 | 72 | </head>
|
129 | 73 | <body>
|
130 | 74 |
|
131 |
| -<div class="demo-container"> |
132 | 75 | <div class="demo">
|
133 |
| - |
134 |
| - <div id="parent"> |
135 |
| - <p>This is the position parent element.</p> |
136 |
| - </div> |
137 |
| - |
138 |
| - <div class="positionable"> |
139 |
| - <p>to position</p> |
140 |
| - </div> |
141 |
| - |
142 |
| - <div class="positionable" style="width:120px; height: 40px;"> |
143 |
| - <p>to position 2</p> |
144 |
| - </div> |
145 |
| - |
146 |
| - <form style="padding: 20px; margin-top: 75px;"> |
147 |
| - <h2>Position configuration: |
148 |
| - <div style="padding-bottom: 20px;"> |
149 |
| - <b>my:</b> |
150 |
| - <select id="my_horizontal"> |
151 |
| - <option value="left">left</option> |
152 |
| - <option value="center">center</option> |
153 |
| - <option value="right" selected="selected">right</option> |
154 |
| - </select> |
155 |
| - <select id="my_vertical"> |
156 |
| - <option value="top">top</option> |
157 |
| - <option value="middle">center</option> |
158 |
| - <option value="bottom">bottom</option> |
159 |
| - </select> |
160 |
| - </div> |
161 |
| - <div style="padding-bottom: 20px;"> |
162 |
| - <b>at:</b> |
163 |
| - <select id="at_horizontal"> |
164 |
| - <option value="left">left</option> |
165 |
| - <option value="center">center</option> |
166 |
| - <option value="right" selected="selected">right</option> |
167 |
| - </select> |
168 |
| - <select id="at_vertical"> |
169 |
| - <option value="top">top</option> |
170 |
| - <option value="middle">center</option> |
171 |
| - <option value="bottom">bottom</option> |
172 |
| - </select> |
173 |
| - </div> |
174 |
| - <div style="padding-bottom: 20px;"> |
175 |
| - <b>collision:</b> |
176 |
| - <select id="collision_horizontal"> |
177 |
| - <option value="flip">flip</option> |
178 |
| - <option value="fit">fit</option> |
179 |
| - <option value="none">none</option> |
180 |
| - </select> |
181 |
| - <select id="collision_vertical"> |
182 |
| - <option value="flip">flip</option> |
183 |
| - <option value="fit">fit</option> |
184 |
| - <option value="none">none</option> |
185 |
| - </select> |
186 |
| - </div> |
187 |
| - <div> |
188 |
| - <label for="within">within:</label> |
189 |
| - <input id="within" type="checkbox" checked /> |
190 |
| - </div> |
191 |
| - <div> |
192 |
| - <label for="margin">extra margin:</label> |
193 |
| - <input id="margin" type="checkbox" /> |
194 |
| - </div> |
195 |
| - </form> |
196 |
| - |
197 |
| -</div><!-- End demo --> |
| 76 | + <div id="target"> |
| 77 | + <p>This is the position target element.</p> |
| 78 | + </div> |
| 79 | + |
| 80 | + <div class="positionable" style="width: 75px; height: 75px;"> |
| 81 | + <p>to position</p> |
| 82 | + </div> |
| 83 | + |
| 84 | + <div class="positionable" style="width:120px; height: 40px;"> |
| 85 | + <p>to position 2</p> |
| 86 | + </div> |
| 87 | + |
| 88 | + <form style="padding: 20px; margin-top: 75px;"> |
| 89 | + <h2>Position configuration:</h2> |
| 90 | + <div style="padding-bottom: 20px;"> |
| 91 | + <b>my:</b> |
| 92 | + <select id="my_horizontal"> |
| 93 | + <option value="left">left</option> |
| 94 | + <option value="center">center</option> |
| 95 | + <option value="right" selected="selected">right</option> |
| 96 | + </select> |
| 97 | + <select id="my_vertical"> |
| 98 | + <option value="top">top</option> |
| 99 | + <option value="middle">center</option> |
| 100 | + <option value="bottom">bottom</option> |
| 101 | + </select> |
| 102 | + </div> |
| 103 | + <div style="padding-bottom: 20px;"> |
| 104 | + <b>at:</b> |
| 105 | + <select id="at_horizontal"> |
| 106 | + <option value="left">left</option> |
| 107 | + <option value="center">center</option> |
| 108 | + <option value="right" selected="selected">right</option> |
| 109 | + </select> |
| 110 | + <select id="at_vertical"> |
| 111 | + <option value="top">top</option> |
| 112 | + <option value="middle">center</option> |
| 113 | + <option value="bottom">bottom</option> |
| 114 | + </select> |
| 115 | + </div> |
| 116 | + <div style="padding-bottom: 20px;"> |
| 117 | + <b>collision:</b> |
| 118 | + <select id="collision_horizontal"> |
| 119 | + <option value="flip">flip</option> |
| 120 | + <option value="fit">fit</option> |
| 121 | + <option value="flipfit">flipfit</option> |
| 122 | + <option value="none">none</option> |
| 123 | + </select> |
| 124 | + <select id="collision_vertical"> |
| 125 | + <option value="flip">flip</option> |
| 126 | + <option value="fit">fit</option> |
| 127 | + <option value="flipfit">flipfit</option> |
| 128 | + <option value="none">none</option> |
| 129 | + </select> |
| 130 | + </div> |
| 131 | + <div> |
| 132 | + <label for="within">within:</label> |
| 133 | + <input id="within" type="checkbox" checked="checked"> |
| 134 | + </div> |
| 135 | + <div> |
| 136 | + <label for="margin">extra margin:</label> |
| 137 | + <input id="margin" type="checkbox"> |
| 138 | + </div> |
| 139 | + </form> |
198 | 140 | </div>
|
199 | 141 |
|
200 | 142 | </body>
|
|
0 commit comments