-
Notifications
You must be signed in to change notification settings - Fork 234
/
Fx.Sort.html
100 lines (87 loc) · 1.89 KB
/
Fx.Sort.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<style type="text/css">
#sorter {
padding-left: 15px;
}
#sorter li {
border: 1px solid #666;
margin: 8px;
padding: 4px;
}
div.spanner {
float: left;
margin: 4px;
padding: 2px;
border: 1px solid #000;
}
</style>
<ol id="sorter">
<li id="li0">(0) stuff</li>
<li id="li1">(1) more stuff<br />
really</li>
<li id="li2">(2) still more stuff</li>
<li id="li3">(3) loads o stuff</li>
<li id="li4">(4) blah<br />
blah<br />
blah</li>
</ol>
<div class="spanner">one</div>
<div class="spanner">two</div>
<div class="spanner">three</div>
<div class="spanner">four</div>
<div class="spanner">five</div>
<script src="/depender/build?require=More/Fx.Sort,Core/Element.Event,Core/Fx.Transitions"></script>
<script type="text/javascript">
var vert = new Fx.Sort($$('#sorter li'), {
transition: Fx.Transitions.Back.easeInOut,
duration: 1000
});
var horz = new Fx.Sort($$('.spanner'), {
mode: "horizontal",
transition: Fx.Transitions.Back.easeInOut,
duration: 1000
});
makeActions([
{
title: "Reverses the order of the lists to 5,4,3,2,1",
fn: function(){
vert.backward();
(function(){horz.backward();}).delay(1000);
}
},
{
title: "Resets the order of the lists to 1,2,3,4,5",
fn: function(){
vert.forward();
(function(){horz.forward();}).delay(1000);
}
},
{
title: "Sets the order of the lists to 5,2,4,3,1",
fn: function(){
vert.sort([4,1,3,2,0]);
(function(){horz.sort([4,1,3,2,0]);}).delay(1000);
}
},
{
title: "Swaps the position of 1 and 5",
fn: function(){
vert.swap(0,4);
(function(){horz.swap(0,4);}).delay(1000);
}
},
{
title: "Reverses the order of the lists",
fn: function(){
vert.reverse();
(function(){horz.reverse();}).delay(1000);
}
},
{
title: "Reorders the DOM to match the current sort order.",
description: "(No visible effect; inspect in firebug.)",
fn: function(){
vert.rearrangeDOM();
}
}
]);
</script>