-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelayout.html
232 lines (180 loc) · 6.66 KB
/
relayout.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>reLayout · Isotope Demo</title>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jquery.isotope.min.js"></script>
<link rel="stylesheet" href="css/style.css" />
</head>
<body class="demos ">
<section id="content">
<h1>ReLayout</h1>
<section id="copy">
<p>Use the reLayout method to easily arrange item elements after a change.</p>
<p>Click on any item element to change its size.</p>
</section>
<section id="options">
<ul class="clearfix">
<li id="toggle-sizes"><a href="#toggle-sizes">Toggle variable sizes</a></li>
</ul>
</section>
<div id="container" class="clickable clearfix">
<div class="element other nonmetal " data-symbol="H" data-category="other">
<p class="number">1</p>
<h3 class="symbol">H</h3>
<h2 class="name">Hydrogen</h2>
<p class="weight">1.00794</p>
</div>
<div class="element noble-gas nonmetal " data-symbol="He" data-category="noble-gas">
<p class="number">2</p>
<h3 class="symbol">He</h3>
<h2 class="name">Helium</h2>
<p class="weight">4.002602</p>
</div>
<div class="element alkali metal " data-symbol="Li" data-category="alkali">
<p class="number">3</p>
<h3 class="symbol">Li</h3>
<h2 class="name">Lithium</h2>
<p class="weight">6.941</p>
</div>
<div class="element alkaline-earth metal " data-symbol="Be" data-category="alkaline-earth">
<p class="number">4</p>
<h3 class="symbol">Be</h3>
<h2 class="name">Beryllium</h2>
<p class="weight">9.012182</p>
</div>
<div class="element metalloid " data-symbol="B" data-category="metalloid">
<p class="number">5</p>
<h3 class="symbol">B</h3>
<h2 class="name">Boron</h2>
<p class="weight">10.811</p>
</div>
<div class="element other nonmetal " data-symbol="C" data-category="other">
<p class="number">6</p>
<h3 class="symbol">C</h3>
<h2 class="name">Carbon</h2>
<p class="weight">12.0107</p>
</div>
<div class="element other nonmetal " data-symbol="N" data-category="other">
<p class="number">7</p>
<h3 class="symbol">N</h3>
<h2 class="name">Nitrogen</h2>
<p class="weight">14.0067</p>
</div>
<div class="element other nonmetal " data-symbol="O" data-category="other">
<p class="number">8</p>
<h3 class="symbol">O</h3>
<h2 class="name">Oxygen</h2>
<p class="weight">15.9994</p>
</div>
<div class="element halogen nonmetal " data-symbol="F" data-category="halogen">
<p class="number">9</p>
<h3 class="symbol">F</h3>
<h2 class="name">Fluorine</h2>
<p class="weight">18.9984032</p>
</div>
<div class="element noble-gas nonmetal " data-symbol="Ne" data-category="noble-gas">
<p class="number">10</p>
<h3 class="symbol">Ne</h3>
<h2 class="name">Neon</h2>
<p class="weight">20.1797</p>
</div>
<div class="element alkali metal " data-symbol="Na" data-category="alkali">
<p class="number">11</p>
<h3 class="symbol">Na</h3>
<h2 class="name">Sodium</h2>
<p class="weight">22.98976928</p>
</div>
<div class="element alkaline-earth metal " data-symbol="Mg" data-category="alkaline-earth">
<p class="number">12</p>
<h3 class="symbol">Mg</h3>
<h2 class="name">Magnesium</h2>
<p class="weight">24.305</p>
</div>
<div class="element post-transition metal " data-symbol="Al" data-category="post-transition">
<p class="number">13</p>
<h3 class="symbol">Al</h3>
<h2 class="name">Aluminium</h2>
<p class="weight">26.9815386</p>
</div>
<div class="element metalloid " data-symbol="Si" data-category="metalloid">
<p class="number">14</p>
<h3 class="symbol">Si</h3>
<h2 class="name">Silicon</h2>
<p class="weight">28.0855</p>
</div>
<div class="element other nonmetal " data-symbol="P" data-category="other">
<p class="number">15</p>
<h3 class="symbol">P</h3>
<h2 class="name">Phosphorus</h2>
<p class="weight">30.973762</p>
</div>
<div class="element other nonmetal " data-symbol="S" data-category="other">
<p class="number">16</p>
<h3 class="symbol">S</h3>
<h2 class="name">Sulfur</h2>
<p class="weight">32.065</p>
</div>
<div class="element halogen nonmetal " data-symbol="Cl" data-category="halogen">
<p class="number">17</p>
<h3 class="symbol">Cl</h3>
<h2 class="name">Chlorine</h2>
<p class="weight">35.453</p>
</div>
<div class="element noble-gas nonmetal " data-symbol="Ar" data-category="noble-gas">
<p class="number">18</p>
<h3 class="symbol">Ar</h3>
<h2 class="name">Argon</h2>
<p class="weight">39.948</p>
</div>
<div class="element alkali metal " data-symbol="K" data-category="alkali">
<p class="number">19</p>
<h3 class="symbol">K</h3>
<h2 class="name">Potassium</h2>
<p class="weight">39.0983</p>
</div>
<div class="element alkaline-earth metal " data-symbol="Ca" data-category="alkaline-earth">
<p class="number">20</p>
<h3 class="symbol">Ca</h3>
<h2 class="name">Calcium</h2>
<p class="weight">40.078</p>
</div>
</div> <!-- #container -->
<script>
$(function(){
var $container = $('#container');
// add randomish size classes
$container.find('.element').each(function(){
var $this = $(this),
number = parseInt( $this.find('.number').text(), 10 );
if ( number % 7 % 2 === 1 ) {
$this.addClass('width2');
}
if ( number % 3 === 0 ) {
$this.addClass('height2');
}
});
$container.isotope({
itemSelector: '.element',
masonry : {
columnWidth : 120
}
});
// change size of clicked element
$container.delegate( '.element', 'click', function(){
$(this).toggleClass('large');
$container.isotope('reLayout');
});
// toggle variable sizes of all elements
$('#toggle-sizes').find('a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
});
</script>
</section> <!-- #content -->
</body>
</html>