source: main/trunk/greenstone3/web/interfaces/oran/js/jquery-ui-1.8rc1/demos/position/default.html@ 24245

Last change on this file since 24245 was 24245, checked in by sjb48, 13 years ago

Oran code for supporting format changes to document.

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1<!doctype html>
2<html lang="en">
3<head>
4 <title>jQuery UI Position - Default functionality</title>
5 <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
6 <script type="text/javascript" src="../../jquery-1.4.1.js"></script>
7 <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
8 <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
9 <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
10 <script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
11 <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
12 <link type="text/css" href="../demos.css" rel="stylesheet" />
13
14 <style type="text/css">
15 div#parent
16 {
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 {
28 width: 75px;
29 height: 75px;
30 position: absolute;
31 display: block;
32 right: 0;
33 bottom: 0;
34
35 background-color: #bcd5e6;
36 text-align: center;
37 }
38
39 select, input
40 {
41 margin-left: 15px;
42 }
43 </style>
44
45 <script type="text/javascript">
46 $(function() {
47
48 function position(using) {
49 $('.positionable').position({
50 of: $('#parent'),
51 my: $('#my_horizontal').val() + ' ' + $('#my_vertical').val(),
52 at: $('#at_horizontal').val() + ' '+ $('#at_vertical').val(),
53 offset: $('#offset').val(),
54 using: using,
55 collision: $("#collision_horizontal").val() + ' ' + $("#collision_vertical").val()
56 });
57 }
58
59 $('.positionable').css("opacity", 0.5);
60
61 $(':input').bind('click keyup change', function() { position(); });
62
63 $("#parent").draggable({
64 drag: function() { position(); }
65 });
66
67 $('.positionable').draggable({
68 drag: function(event, ui) {
69 // reset offset before calculating it
70 $("#offset").val("0");
71 position(function(result) {
72 $("#offset").val("" + (ui.offset.left - result.left) + " " + (ui.offset.top - result.top));
73 position();
74 });
75 }
76 });
77
78 position();
79 });
80 </script>
81
82</head>
83<body>
84
85<div class="demo">
86
87<div id="parent">
88 <p>
89 This is the position parent element.
90 </p>
91</div>
92
93<div class="positionable">
94 <p>
95 to position
96 </p>
97</div>
98
99<div class="positionable" style="width:120px; height: 40px;">
100 <p>
101 to position 2
102 </p>
103</div>
104
105<div style="padding: 20px; margin-top: 75px;">
106 position...
107 <div style="padding-bottom: 20px;">
108 <b>my:</b>
109 <select id="my_horizontal">
110 <option value="left">left</option>
111 <option value="center">center</option>
112 <option value="right">right</option>
113 </select>
114 <select id="my_vertical">
115 <option value="top">top</option>
116 <option value="middle">center</option>
117 <option value="bottom">bottom</option>
118 </select>
119 </div>
120 <div style="padding-bottom: 20px;">
121 <b>at:</b>
122 <select id="at_horizontal">
123 <option value="left">left</option>
124 <option value="center">center</option>
125 <option value="right">right</option>
126 </select>
127 <select id="at_vertical">
128 <option value="top">top</option>
129 <option value="middle">center</option>
130 <option value="bottom">bottom</option>
131 </select>
132 </div>
133 <div style="padding-bottom: 20px;">
134 <b>offset:</b>
135 <input id="offset" type="text" size="15"/>
136 </div>
137 <div style="padding-bottom: 20px;">
138 <b>collision:</b>
139 <select id="collision_horizontal">
140 <option value="flip">flip</option>
141 <option value="fit">fit</option>
142 <option value="none">none</option>
143 </select>
144 <select id="collision_vertical">
145 <option value="flip">flip</option>
146 <option value="fit">fit</option>
147 <option value="none">none</option>
148 </select>
149 </div>
150</div>
151
152<div class="demo-description">
153
154<p>Use the form controls to configure the positioning, or drag the positioned element to modify its offset.
155<br/>Drag around the parent element to see collision detection in action.</p>
156
157</div><!-- End demo-description -->
158
159</body>
160</html>
Note: See TracBrowser for help on using the repository browser.