-
Notifications
You must be signed in to change notification settings - Fork 9
/
Demo.html
206 lines (162 loc) · 6.01 KB
/
Demo.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>FancySelect demo page</title>
<!-- Include Mootools and FancySelect -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script>
<script type="text/javascript" src="Source/FancySelect.js"></script>
<link type="text/css" href="Source/FancySelect.css" rel="stylesheet">
<script type="text/javascript">
window.addEvent('domready', function() {
// Images + Text
$('fruits').fancySelect();
// Images only
$('yummy').fancySelect({
showText: false,
showImages: true,
className: 'fancy-select fancy-select-big'
});
// Text only
$('textonly').fancySelect({
showText: true,
showImages: false
});
// Attach / Detach buttons (you don't need this)
$$('button.attach').addEvent('click', function() {
var select = this.getPrevious('select');
if (select.getStyle('display') == 'none') {
select.get('fancySelect').detach();
this.set('text', 'Attach');
this.getNext('button.toggle').set('disabled', true);
} else {
select.get('fancySelect').attach();
this.set('text', 'Detach');
this.getNext('button.toggle').set('disabled', false);
}
});
// Toggle buttons (you don't need this)
$$('button.toggle').addEvent('click', function() {
var select = this.getPrevious('select');
if (select.getStyle('display') == 'none') select.fancySelectToggle();
});
});
</script>
<style type="text/css">
/* These rules does not style the FancySelect.
* See Source/FancySelect.css for the dropdown styling. */
body {
font-family: sans-serif;
font-size: 13px;
}
div {
margin: 20px 10px;
}
p {
color: #666666;
margin: 20px 10px;
clear: both;
}
p b {
color: #333333;
}
a {
font-weight: bold;
color: #3344FF;
}
a:hover {
font-weight: bold;
color: #6677FF;
}
pre {
font-size: 12px;
padding: 10px 15px;
background-color: #eeffef;
border: 1px solid #cceedf;
margin: 10px 40px;
}
pre.javascript {
background-color: #eeefff;
border: 1px solid #ccdfee;
}
</style>
</head>
<body>
<div><h1>FancySelect demo page</h1></div>
<p>
A non-obtrusive <b>image dropdown menu</b> that extends and replaces
a standard HTML Select control.<br>
Requires Mootools Core 1.4.1 or later.<br>
Download and HowTo on <a href="http://mootools.net/forge/p/fancyselect">Mootools Forge</a>, sources and issues on
<a href="https://github.com/lorenzos/FancySelect">GitHub</a>, full documentation
<a href="https://github.com/lorenzos/FancySelect/wiki/Docs">here</a>.
</p>
<p>
<b>Simplest example</b>, pick a fruit:
<select name="fruits" id="fruits">
<option value="1" data-image="Graphics/Fruits/Apple.png">Apple</option>
<option value="2" data-image="Graphics/Fruits/Banana.png">Banana</option>
<option value="3" data-image="Graphics/Fruits/Cherries.png">Cherries</option>
<option value="4" data-image="Graphics/Fruits/Lemon.png">Lemon</option>
<option value="5" data-image="Graphics/Fruits/Strawberry.png">Strawberry</option>
<option value="6" data-image="Graphics/Fruits/Watermelon.png">Watermelon</option>
</select>
<button class="attach" type="button">Detach</button>
<button class="toggle" type="button">Toggle</button>
</p>
<pre class="html"><select name="fruits" id="fruits">
<option value="1" data-image="Graphics/Fruits/Apple.png">Apple</option>
<option value="2" data-image="Graphics/Fruits/Banana.png">Banana</option>
...
</select></pre>
<pre class="javascript">$('fruits').fancySelect();</pre>
<p>
<b>Only pictures</b>, yummy!
<select name="yummy" id="yummy">
<option value="a" data-image="Graphics/Yummy/Cake.png" data-alt="This is a cake">Cake</option>
<option value="b" data-image="Graphics/Yummy/Cheesecake.png" data-alt="Cheesecake!">Cheesecake</option>
<option value="c" data-image="Graphics/Yummy/Croissant.png" data-alt="Croissant">Croissant</option>
<option value="d" data-image="Graphics/Yummy/Donut.png" data-alt="Donut">Donut</option>
</select>
<button class="attach" type="button">Detach</button>
<button class="toggle" type="button">Toggle</button>
</p>
<pre class="html"><select name="yummy" id="yummy">
<option value="a" data-image="Graphics/Fruit/Cake.png" data-alt="This is a cake">Cake</option>
<option value="b" data-image="Graphics/Fruit/Cheesecake.png" data-alt="Cheesecake!">Cheesecake</option>
...
</select></pre>
<pre class="javascript">$('yummy').fancySelect({
showText: false,
showImages: true,
className: 'fancy-select fancy-select-big'
});</pre>
<p>
This is a <b>text-only</b> version:
<select name="textonly" id="textonly">
<option value="1">Lorem ipsum</option>
<option value="2">Dolor sit amet</option>
<option value="3">Consectetuer</option>
<option value="4">Adipiscing </option>
</select>
<button class="attach" type="button">Detach</button>
<button class="toggle" type="button">Toggle</button>
</p>
<pre class="html"><select name="textonly" id="textonly">
<option value="1">Lorem ipsum</option>
<option value="2">Dolor sit amet</option>
...
</select></pre>
<pre class="javascript">$('textonly').fancySelect({
showText: true,
showImages: false
});</pre>
<div>
<p>
Icons from
<a href="http://kevinandersson.deviantart.com/art/Fruits-Illustrated-64938333" target="_blank">Fruits Illustrated set</a>
and <a href="http://www.iconeden.com/icon/yummy-free-icons.html" target="_blank">Yummy free set</a>.
</p>
</div>
</body>
</html>