forked from paulstraw/FancySelect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
184 lines (140 loc) · 5.83 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="A better select for discerning web developers everywhere.">
<meta name="designer" content="Octopus Creative">
<meta name="developer" content="Octopus Creative">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<title>FancySelect » Octopus Code</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" media="screen, projection" href="index.css">
<link rel="stylesheet" media="screen, projection" href="fancySelect.css">
<style type="text/css">
div.repo div.logo { background: #62C8BF; }
body { background: #7A8498; }
div#main { font-size: 16px; line-height: 26px; color: #fff; }
div#main div.fancy-select { margin: 0 auto 60px; width: 200px; }
div#main p { margin-bottom: 24px; }
div#main a { text-decoration: none; color: #BAC9E7; font-weight: 600; }
div#main code { font-size: 16px; padding: 2px 3px; background: #5A606F; color: #fff; border-radius: 4px; font-family: "Inconsolata", monospace; }
div#main pre { padding: 27px 27px 30px; background: #5A606F; color: #fff; border-radius: 4px; white-space: pre-wrap; max-width: 540px; line-height: 28px; margin-bottom: 30px; }
div#main pre code { padding: 0; background: transparent; border-radius: 0; margin-bottom: 18px; }
div#main section { width: 940px; margin: 90px auto; }
div#main section h2, div#main section h3 { font-size: 22px; margin-bottom: 18px; font-weight: 600; }
/*one column*/
@media only screen and (max-width: 639px) {
div#main section { width: 300px; }
}
/*two columns*/
@media only screen and (min-width: 640px) and (max-width: 959px) {
div#main section { width: 620px; }
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="fancySelect.js"></script>
<script>
$(document).ready(function() {
$('#basic-usage-demo').fancySelect();
// Boilerplate
var repoName = 'fancyselect'
$.get('https://api.github.com/repos/octopuscreative/' + repoName, function(repo) {
var el = $('#top').find('.repo');
el.find('.stars').text(repo.watchers_count);
el.find('.forks').text(repo.forks_count);
});
var menu = $('#top').find('menu');
function positionMenuArrow() {
var current = menu.find('.current');
menu.find('.arrow').css('left', current.offset().left + (current.outerWidth() / 2));
}
$(window).on('resize', positionMenuArrow);
menu.on('click', 'a', function(e) {
var el = $(this),
href = el.attr('href'),
currentSection = $('#main').find('.current');
e.preventDefault();
menu.find('.current').removeClass('current');
el.addClass('current');
positionMenuArrow();
if (currentSection.length) {
currentSection.fadeOut(300).promise().done(function() {
$(href).addClass('current').fadeIn(300);
});
} else {
$(href).addClass('current').fadeIn(300);
}
});
menu.find('a:first').trigger('click')
});
</script>
</head>
<body>
<div id="top" class="group">
<header id="octopus">
<h2>
Octopus Creative
<a href="http://code.octopuscreative.com">Finely crafted, open source</a>
</h2>
</header>
<div class="repo group">
<a href="http://code.octopuscreative.com/fancyselect" class="left">
<div class="logo">
<img src="logo.png">
</div>
<div class="description">
<h1>FancySelect</h1>
<p>A better select for discerning web developers everywhere.</p>
</div>
</a>
<a href="https://github.com/octopuscreative/fancyselect" class="github">
<span>GitHub</span>
<ul>
<li class="icon stars"></li>
<li class="icon forks"></li>
</ul>
</a>
</div>
<menu>
<div class="arrow"></div>
<ul>
<li><a href="#basic-usage">Basic Usage</a></li>
<li><a href="#updating-options">Updating Options</a></li>
</ul>
</menu>
</div>
<div id="main">
<section id="basic-usage">
<select id="basic-usage-demo">
<option value="">Pick Something…</option>
<option>Lorem Ipsum</option>
<option>Dolor Sit</option>
<option>Vehicula Ornare</option>
</select>
<p>FancySelect is easy to use. Just target any <code>select</code> element on the page, and call <code>.fancySelect()</code> on it. If the select has an option with no value, it'll be used as a sort of placeholder text.</p>
<p>By default, FancySelect uses native selects and styles only the trigger on iOS devices. To override this, pass an object with <code>forceiOS</code> set to <code>true</code> when initializing it.</p>
<p>FancySelect also passes any classes specified in the select's <code>data-class</code> attribute, which you can use to style specific FancySelect instances.</p>
<h3>HTML</h3>
<pre><code><select class="basic">
<option value="">Select something…</option>
<option>Lorem</option>
<option>Ipsum</option>
<option>Dolor</option>
<option>Sit</option>
<option>Amet</option>
</select></code></pre>
<h3>JavaScript</h3>
<pre><code>$('.basic').fancySelect();</code></pre>
</section>
<section id="updating-options">
<p>If the options in your select change after initializing FancySelect, you can tell it to rebuild the list of options by triggering <code>update</code> on the select element.</p>
<h3>JavaScript</h3>
<pre><code>var mySelect = $('.my-select');
mySelect.fancySelect();
mySelect.append('<option>Foo</option><option>Bar</option>');
mySelect.trigger('update');</code></pre>
</section>
</div>
</body>
</html>