|
11 | 11 | <script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
12 | 12 | <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
|
13 | 13 | <link type="text/css" href="../demos.css" rel="stylesheet" />
|
14 |
| - |
15 |
| - <style type="text/css"> |
16 |
| - div#parent |
17 |
| - { |
18 |
| - width: 60%; |
19 |
| - margin: 10px auto; |
20 |
| - padding: 5px; |
21 |
| - |
22 |
| - border: 1px solid #777; |
23 |
| - background-color: #fbca93; |
24 |
| - text-align: center; |
25 |
| - } |
| 14 | + <style type="text/css"> |
26 | 15 |
|
27 |
| - div.positionable |
28 |
| - { |
29 |
| - width: 75px; |
30 |
| - height: 75px; |
| 16 | + div#parent { |
| 17 | + width: 60%; |
| 18 | + margin: 10px auto; |
| 19 | + padding: 5px; |
| 20 | + |
| 21 | + border: 1px solid #777; |
| 22 | + background-color: #fbca93; |
| 23 | + text-align: center; |
| 24 | + } |
| 25 | + |
| 26 | + div.positionable { |
| 27 | + width: 75px; |
| 28 | + height: 75px; |
31 | 29 | position: absolute;
|
32 |
| - display: block; |
33 |
| - right: 0; |
34 |
| - bottom: 0; |
| 30 | + display: block; |
| 31 | + right: 0; |
| 32 | + bottom: 0; |
| 33 | + background-color: #bcd5e6; |
| 34 | + text-align: center; |
| 35 | + } |
35 | 36 |
|
36 |
| - background-color: #bcd5e6; |
37 |
| - text-align: center; |
38 |
| - } |
| 37 | + select, input { |
| 38 | + margin-left: 15px; |
| 39 | + } |
39 | 40 |
|
40 |
| - select, input |
41 |
| - { |
42 |
| - margin-left: 15px; |
43 |
| - } |
44 |
| - </style> |
45 |
| - |
| 41 | + </style> |
46 | 42 | <script type="text/javascript">
|
47 | 43 | $(function() {
|
48 | 44 |
|
49 | 45 | function position(using) {
|
50 |
| - $('.positionable').position({ |
51 |
| - of: $('#parent'), |
52 |
| - my: $('#my_horizontal').val() + ' ' + $('#my_vertical').val(), |
53 |
| - at: $('#at_horizontal').val() + ' '+ $('#at_vertical').val(), |
54 |
| - offset: $('#offset').val(), |
| 46 | + $('.positionable').position({ |
| 47 | + of: $('#parent'), |
| 48 | + my: $('#my_horizontal').val() + ' ' + $('#my_vertical').val(), |
| 49 | + at: $('#at_horizontal').val() + ' '+ $('#at_vertical').val(), |
| 50 | + offset: $('#offset').val(), |
55 | 51 | using: using,
|
56 | 52 | collision: $("#collision_horizontal").val() + ' ' + $("#collision_vertical").val()
|
57 |
| - }); |
| 53 | + }); |
58 | 54 | }
|
59 | 55 |
|
60 | 56 | $('.positionable').css("opacity", 0.5);
|
61 | 57 |
|
62 |
| - $(':input').bind('click keyup change', function() { position(); }); |
| 58 | + $(':input').bind('click keyup change', function() { position(); }); |
63 | 59 |
|
64 | 60 | $("#parent").draggable({
|
65 | 61 | drag: function() { position(); }
|
|
79 | 75 | position();
|
80 | 76 | });
|
81 | 77 | </script>
|
82 |
| - |
| 78 | + |
83 | 79 | </head>
|
84 | 80 | <body>
|
85 | 81 |
|
86 | 82 | <div class="demo">
|
87 | 83 |
|
88 | 84 | <div id="parent">
|
89 | 85 | <p>
|
90 |
| - This is the position parent element. |
91 |
| - </p> |
| 86 | + This is the position parent element. |
| 87 | + </p> |
92 | 88 | </div>
|
93 | 89 |
|
94 | 90 | <div class="positionable">
|
95 |
| - <p> |
96 |
| - to position |
97 |
| - </p> |
| 91 | + <p> |
| 92 | + to position |
| 93 | + </p> |
98 | 94 | </div>
|
99 | 95 |
|
100 | 96 | <div class="positionable" style="width:120px; height: 40px;">
|
101 |
| - <p> |
102 |
| - to position 2 |
103 |
| - </p> |
| 97 | + <p> |
| 98 | + to position 2 |
| 99 | + </p> |
104 | 100 | </div>
|
105 | 101 |
|
106 | 102 | <div style="padding: 20px; margin-top: 75px;">
|
107 | 103 | position...
|
108 |
| - <div style="padding-bottom: 20px;"> |
109 |
| - <b>my:</b> |
110 |
| - <select id="my_horizontal"> |
111 |
| - <option value="left">left</option> |
112 |
| - <option value="center">center</option> |
113 |
| - <option value="right">right</option> |
114 |
| - </select> |
115 |
| - <select id="my_vertical"> |
116 |
| - <option value="top">top</option> |
117 |
| - <option value="middle">center</option> |
118 |
| - <option value="bottom">bottom</option> |
119 |
| - </select> |
120 |
| - </div> |
121 |
| - <div style="padding-bottom: 20px;"> |
122 |
| - <b>at:</b> |
123 |
| - <select id="at_horizontal"> |
124 |
| - <option value="left">left</option> |
125 |
| - <option value="center">center</option> |
126 |
| - <option value="right">right</option> |
127 |
| - </select> |
128 |
| - <select id="at_vertical"> |
129 |
| - <option value="top">top</option> |
130 |
| - <option value="middle">center</option> |
131 |
| - <option value="bottom">bottom</option> |
132 |
| - </select> |
133 |
| - </div> |
134 |
| - <div style="padding-bottom: 20px;"> |
135 |
| - <b>offset:</b> |
136 |
| - <input id="offset" type="text" size="15"/> |
137 |
| - </div> |
138 | 104 | <div style="padding-bottom: 20px;">
|
139 |
| - <b>collision:</b> |
140 |
| - <select id="collision_horizontal"> |
141 |
| - <option value="flip">flip</option> |
142 |
| - <option value="fit">fit</option> |
143 |
| - <option value="none">none</option> |
144 |
| - </select> |
145 |
| - <select id="collision_vertical"> |
146 |
| - <option value="flip">flip</option> |
147 |
| - <option value="fit">fit</option> |
148 |
| - <option value="none">none</option> |
149 |
| - </select> |
150 |
| - </div> |
| 105 | + <b>my:</b> |
| 106 | + <select id="my_horizontal"> |
| 107 | + <option value="left">left</option> |
| 108 | + <option value="center">center</option> |
| 109 | + <option value="right">right</option> |
| 110 | + </select> |
| 111 | + <select id="my_vertical"> |
| 112 | + <option value="top">top</option> |
| 113 | + <option value="middle">center</option> |
| 114 | + <option value="bottom">bottom</option> |
| 115 | + </select> |
| 116 | + </div> |
| 117 | + <div style="padding-bottom: 20px;"> |
| 118 | + <b>at:</b> |
| 119 | + <select id="at_horizontal"> |
| 120 | + <option value="left">left</option> |
| 121 | + <option value="center">center</option> |
| 122 | + <option value="right">right</option> |
| 123 | + </select> |
| 124 | + <select id="at_vertical"> |
| 125 | + <option value="top">top</option> |
| 126 | + <option value="middle">center</option> |
| 127 | + <option value="bottom">bottom</option> |
| 128 | + </select> |
| 129 | + </div> |
| 130 | + <div style="padding-bottom: 20px;"> |
| 131 | + <b>offset:</b> |
| 132 | + <input id="offset" type="text" size="15"/> |
| 133 | + </div> |
| 134 | + <div style="padding-bottom: 20px;"> |
| 135 | + <b>collision:</b> |
| 136 | + <select id="collision_horizontal"> |
| 137 | + <option value="flip">flip</option> |
| 138 | + <option value="fit">fit</option> |
| 139 | + <option value="none">none</option> |
| 140 | + </select> |
| 141 | + <select id="collision_vertical"> |
| 142 | + <option value="flip">flip</option> |
| 143 | + <option value="fit">fit</option> |
| 144 | + <option value="none">none</option> |
| 145 | + </select> |
| 146 | + </div> |
151 | 147 | </div>
|
152 | 148 |
|
| 149 | +</div><!-- End demo --> |
| 150 | + |
153 | 151 | <div class="demo-description">
|
154 | 152 |
|
155 | 153 | <p>Use the form controls to configure the positioning, or drag the positioned element to modify its offset.
|
|
0 commit comments