-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
312 lines (265 loc) · 10.6 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="en">
<head prefix="og: https://ogp.me/ns#">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" />
<title>Rhiannon Zine</title>
<!-- social media preview -->
<meta property="og:title" content="Rhiannon Zine" />
<meta property="og:description"
content="Online zine inspired by the Fleetwood Mac classic, Rhiannon" />
<meta property="og:image" content="https://sara-harvey.github.io/rhiannon-zine/assets/birdFB.png" />
<meta property="og:url" content="https://sara-harvey.github.io/rhiannon-zine/">
<!-- Twitter preview card -->
<meta property="Twitter:title" content="Rhiannon Zine" />
<meta name="twitter:description" content="Online zine inspired by the Fleetwood Mac classic, Rhiannon">
<meta property="og:image" content="https://sara-harvey.github.io/rhiannon-zine/assets/rhizine5.png" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:creator" content="@saraharvy" />
</head>
<body>
<div class="container">
<div class="overlay">
<div class="big-name-graphic">Rhiannon</div>
<div class="moon-animation"></div>
<div class="stars-appear"><image src="assets/stars.png" width="100%"></div>
</div>
<header>
<h1>Rhiannon</h1>
<ul class="main-nav">
<li><a href="about.html">About</a></li>
<li><audio controls><source src='01Rhiannon.mp3' type="audio/mp3"></audio></li>
</ul>
</header>
<div class="carousel">
<div class="nav nav-left">
<div class="ion-chevron-left carousel-arrow-icon-left"></div>
</div>
<div class="carousel-content">
<div class="slide slide-1">
<div><image src="assets/rhizine1.png" width="100%"></div>
<div style="width:95%">
<p>Rhiannon rings like a bell through
the night, and wouldn't you love
to love her?
Takes to the sky like a bird in flight,
and who will be her lover?</p>
</div>
</div>
<div class="slide slide-2">
<div><image src="assets/rhizine2.png" width="100%"></div>
<div style="width:95%">
<p>All your life you've never seen a woman
taken by the wind. Would you stay if she
promised you heaven? Will you ever win? Will you ever win?</p>
</div>
</div>
<div class="slide slide-3">
<div><image src="assets/rhizine3.png" width="100%"></div>
<div style="width:95%">
<p>She is like a cat in the dark and then she is
the darkness. She rules her life like a fine skylark,
and when the sky is starless</p>
</div>
</div>
<div class="slide slide-4">
<div><image src="assets/rhizine4.png" width="100%"></div>
<div style="width:95%">
<p>All your life you've never seen a woman taken by
the wind. Would you stay if she promised you heaven?
Will you ever win? Will you ever win?</p>
</div>
</div>
<div class="slide slide-5">
<div><image src="assets/rhizine5.png" width="100%"></div>
<div style="width:95%">
<p>She rings like a bell through the night, and
wouldn't you love to love her? Takes to the sky like
a bird in flight, and who will be her lover?</p>
</div>
</div>
<div class="slide slide-6">
<div><image src="assets/rhizine6.png" width="100%"></div>
<div style="width:95%">
<p>All your life you've never seen a woman taken by
the wind. Would you stay if she promised you heaven?
Will you ever win? Rhiannon</p>
</div>
</div>
<div class="slide slide-7">
<div><image src="assets/rhizine7.png" width="100%"></div>
<div style="width:95%">
<p>Taken by,</p>
<p>taken by the wind.</p>
<p>Dreams unwind,</p>
<p>love's a state of mind.</p>
<p>—Stevie Nicks, Fleetwood Mac</p>
</div>
</div>
<div class="slide slide-8">
<div><image src="assets/rhizine8.png" width="100%"></div>
<div style="width:95%">
<p>Art by Sara Harvey ©2020</p>
<p>IG <a href="https://www.instagram.com/ambivalent_sun/" target="_blank">@ambivalent_sun</a></p>
<p><a href="http://saraharvey.xyz/" target="_blank">saraharvey.xyz</a></p>
<p>Open-souce fonts: <a href="http://velvetyne.fr/fonts/trickster/" target="_blank">Trickster</a>, <a href="https://www.pepite-collectif.com/portfolio/moche/" target="_blank">Moche</a></p>
</div>
</div>
</div>
<div class="nav nav-right">
<div class="ion-chevron-right carousel-arrow-icon-right"></div>
</div>
</div>
</div>
<script>
var carousel = document.querySelector('.carousel');
var carouselContent = document.querySelector('.carousel-content');
var slides = document.querySelectorAll('.slide');
var arrayOfSlides = Array.prototype.slice.call(slides);
var carouselDisplaying;
var screenSize;
setScreenSize();
var lengthOfSlide;
function addClone() {
var lastSlide = carouselContent.lastElementChild.cloneNode(true);
lastSlide.style.left = (-lengthOfSlide) + "px";
carouselContent.insertBefore(lastSlide, carouselContent.firstChild);
}
// addClone();
function removeClone() {
var firstSlide = carouselContent.firstElementChild;
firstSlide.parentNode.removeChild(firstSlide);
}
function moveSlidesRight() {
var slides = document.querySelectorAll('.slide');
var slidesArray = Array.prototype.slice.call(slides);
var width = 0;
slidesArray.forEach(function(el, i){
el.style.left = width + "px";
width += lengthOfSlide;
});
addClone();
}
moveSlidesRight();
function moveSlidesLeft() {
var slides = document.querySelectorAll('.slide');
var slidesArray = Array.prototype.slice.call(slides);
slidesArray = slidesArray.reverse();
var maxWidth = (slidesArray.length - 1) * lengthOfSlide;
slidesArray.forEach(function(el, i){
maxWidth -= lengthOfSlide;
el.style.left = maxWidth + "px";
});
}
window.addEventListener('resize', setScreenSize);
function setScreenSize() {
if ( window.innerWidth >= 500 ) {
carouselDisplaying = 3;
} else if ( window.innerWidth >= 300 ) {
carouselDisplaying = 1;
} else {
carouselDisplaying = 1;
}
getScreenSize();
}
function getScreenSize() {
var slides = document.querySelectorAll('.slide');
var slidesArray = Array.prototype.slice.call(slides);
lengthOfSlide = ( carousel.offsetWidth / carouselDisplaying );
var initialWidth = -lengthOfSlide;
slidesArray.forEach(function(el) {
el.style.width = lengthOfSlide + "px";
el.style.left = initialWidth + "px";
initialWidth += lengthOfSlide;
});
}
var rightNav = document.querySelector('.nav-right');
rightNav.addEventListener('click', moveLeft);
var moving = true;
function moveRight() {
if ( moving ) {
moving = false;
var lastSlide = carouselContent.lastElementChild;
lastSlide.parentNode.removeChild(lastSlide);
carouselContent.insertBefore(lastSlide, carouselContent.firstChild);
removeClone();
var firstSlide = carouselContent.firstElementChild;
firstSlide.addEventListener('transitionend', activateAgain);
moveSlidesRight();
}
}
function activateAgain() {
var firstSlide = carouselContent.firstElementChild;
moving = true;
firstSlide.removeEventListener('transitionend', activateAgain);
}
var leftNav = document.querySelector('.nav-left');
leftNav.addEventListener('click', moveRight);
// var moveLeftAgain = true;
function moveLeft() {
if ( moving ) {
moving = false;
removeClone();
var firstSlide = carouselContent.firstElementChild;
firstSlide.addEventListener('transitionend', replaceToEnd);
moveSlidesLeft();
}
}
function replaceToEnd() {
var firstSlide = carouselContent.firstElementChild;
firstSlide.parentNode.removeChild(firstSlide);
carouselContent.appendChild(firstSlide);
firstSlide.style.left = ( (arrayOfSlides.length -1) * lengthOfSlide) + "px";
addClone();
moving = true;
firstSlide.removeEventListener('transitionend', replaceToEnd);
}
carouselContent.addEventListener('mousedown', seeMovement);
var initialX;
var initialPos;
function seeMovement(e) {
initialX = e.clientX;
getInitialPos();
carouselContent.addEventListener('mousemove', slightMove);
document.addEventListener('mouseup', moveBasedOnMouse);
}
function slightMove(e) {
if ( moving ) {
var movingX = e.clientX;
var difference = initialX - movingX;
if ( Math.abs(difference) < (lengthOfSlide/4) ) {
slightMoveSlides(difference);
}
}
}
function getInitialPos() {
var slides = document.querySelectorAll('.slide');
var slidesArray = Array.prototype.slice.call(slides);
initialPos = [];
slidesArray.forEach(function(el){
var left = Math.floor( parseInt( el.style.left.slice(0, -2 ) ) );
initialPos.push( left );
});
}
function slightMoveSlides(newX) {
var slides = document.querySelectorAll('.slide');
var slidesArray = Array.prototype.slice.call(slides);
slidesArray.forEach(function(el, i){
var oldLeft = initialPos[i];
el.style.left = (oldLeft + newX) + "px";
});
}
function moveBasedOnMouse(e) {
var finalX = e.clientX;
if ( initialX - finalX > 0) {
moveRight();
} else if ( initialX - finalX < 0 ) {
moveLeft();
}
document.removeEventListener('mouseup', moveBasedOnMouse);
carouselContent.removeEventListener('mousemove', slightMove);
}
</script>
</body>
</html>