Skip to content

Commit 7e9315a

Browse files
committed
Position cycler demo: Cleanup.
1 parent e318e5b commit 7e9315a

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

demos/position/cycler.html

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
@@ -9,46 +9,32 @@
99
<script src="../../ui/jquery.ui.widget.js"></script>
1010
<script src="../../ui/jquery.ui.position.js"></script>
1111
<link rel="stylesheet" href="../demos.css">
12-
<style>
13-
html, body {
14-
margin: 0;
15-
padding: 0
16-
}
17-
</style>
1812
<script>
1913
$(function() {
2014
// TODO refactor into a widget and get rid of these plugin methods
21-
$.fn.position2 = function( options ) {
22-
return this.position( $.extend({
23-
of: window,
24-
using: function( to ) {
25-
$( this ).css({
26-
top: to.top,
27-
left: to.left
28-
})
29-
},
30-
collision: "none"
31-
}, options));
32-
}
33-
3415
$.fn.left = function( using ) {
35-
return this.position2({
16+
return this.position({
3617
my: "right middle",
3718
at: "left+25 middle",
19+
of: window,
20+
collision: "none",
3821
using: using
3922
});
40-
}
23+
};
4124
$.fn.right = function( using ) {
42-
return this.position2({
25+
return this.position({
4326
my: "left middle",
4427
at: "right-25 middle",
28+
of: window,
29+
collision: "none",
4530
using: using
4631
});
47-
}
32+
};
4833
$.fn.center = function( using ) {
49-
return this.position2({
34+
return this.position({
5035
my: "center middle",
5136
at: "center middle",
37+
of: window,
5238
using: using
5339
});
5440
};
@@ -68,7 +54,7 @@
6854
$( "img:eq(2)" ).right();
6955

7056
function animate( to ) {
71-
$(this).stop( true, false ).animate( to );
57+
$( this ).stop( true, false ).animate( to );
7258
}
7359
function next( event ) {
7460
event.preventDefault();

0 commit comments

Comments
 (0)