author | ymh <ymh.work@gmail.com> |
Sat, 12 Jun 2010 00:33:37 +0200 | |
changeset 30 | 81d408373dde |
permissions | -rw-r--r-- |
30
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<!DOCTYPE html> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
<html lang="en"> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
<head> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
<meta charset="UTF-8" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
<title>jQuery UI Position - Default functionality</title> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
<script type="text/javascript" src="../../jquery-1.4.2.js"></script> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
<link type="text/css" href="../demos.css" rel="stylesheet" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
<style type="text/css"> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
html, body { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
margin: 0; |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
padding: 0 |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
</style> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
<script type="text/javascript"> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
$(function() { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
$.fn.position2 = function(options) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
return this.position($.extend({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
of: window, |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
using: function(to) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
$(this).css({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
top: to.top, |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
left: to.left |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
}) |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
}, |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
collision: "none" |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
}, options)); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
$.fn.left = function(using) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
return this.position2({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
my: "right middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
at: "left middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
offset: "25 0", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
using: using |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
$.fn.right = function(using) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
return this.position2({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
my: "left middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
at: "right middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
offset: "-25 0", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
using: using |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
$.fn.center = function(using) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
return this.position2({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
my: "center middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
at: "center middle", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
using: using |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
}; |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
59 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
60 |
$("img:eq(0)").left(); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
$("img:eq(1)").center(); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
$("img:eq(2)").right(); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
63 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
$("body").css({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
overflow: "hidden" |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
}) |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
67 |
$(".demo").css({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
68 |
position: "relative", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
70 |
$(".demo img").css({ |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
position: "absolute", |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
function animate(to) { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
$(this).animate(to); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
function next() { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
78 |
$("img:eq(2)").center(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
79 |
$("img:eq(1)").left(animate) |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
80 |
$("img:eq(0)").right().appendTo(".demo"); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
81 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
82 |
function previous() { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
83 |
$("img:eq(0)").center(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
84 |
$("img:eq(1)").right(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
85 |
$("img:eq(2)").left().prependTo(".demo"); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
86 |
} |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
87 |
$("#previous").click(previous); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
88 |
$("#next").click(next); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
89 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
90 |
$(".demo img").click(function() { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
91 |
$(".demo img").index(this) == 0 ? previous() : next(); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
92 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
93 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
94 |
$(window).resize(function() { |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
95 |
$("img:eq(0)").left(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
96 |
$("img:eq(1)").center(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
97 |
$("img:eq(2)").right(animate); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
98 |
}) |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
99 |
}); |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
100 |
</script> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
101 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
102 |
</head> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
103 |
<body> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
104 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
105 |
<div class="demo"> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
106 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
107 |
<img src="images/earth.jpg" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
108 |
<img src="images/flight.jpg" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
109 |
<img src="images/rocket.jpg" /> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
110 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
111 |
<a id="previous" href="#">Previous</a> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
112 |
<a id="next" href="#">Next</a> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
113 |
</div> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
114 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
115 |
<div class="demo-description"> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
116 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
117 |
<p>A prototype for the <a href="http://wiki.jqueryui.com/Photoviewer">Photoviewer</a> using Position to place images at the center, left and right and cycle them. |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
118 |
<br/>Use the links at the top to cycle, or click on the images on the left and right. |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
119 |
<br/>Note how the images are repositioned when resizing the window. |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
120 |
<br/>Warning: Doesn't currently work inside the demo viewer; open in a new window instead!</p> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
121 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
122 |
</div><!-- End demo-description --> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
123 |
|
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
124 |
</body> |
81d408373dde
itry to have the player in the preview page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
125 |
</html> |