-
Notifications
You must be signed in to change notification settings - Fork 0
/
CrazyChickens.html.bak
300 lines (212 loc) · 7.81 KB
/
CrazyChickens.html.bak
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
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=0.1">
<meta charset="UTF-8" />
<link rel="stylesheet" href="CrazyChickensCSS.css">
<link rel="stylesheet" href="stylesheet.css">
<link rel="stylesheet" href="Big.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body class="noselect">
<ul>
<li><a href="#ComingSoon......">......</a></li>
<li><a href="#ComingSoon......">Soon</a></li>
<li><a href="#ComingSoon......">Coming </a></li>
<!-- Add font awesome icons -->
<a href="https://twitter.com/CrazyChickens_" target="_blank" class="fa fa-twitter border"></a>
<a href="" class="fa discordicon border"></a>
</ul>
<div class="Banner ">
<img class="bg" src="Banner.png" alt="Banner for CrazyChickens">
<script>
const images = document.getElementsByTagName('img');
for (let i = 0; i < images.length; i++) {
images[i].addEventListener('contextmenu', event => event.preventDefault());
}
</script>
<p class="titletext noselect">Crazy Chickens</p>
<p class="Subtitle1">Going to be released soon on the solana chickencoop!</p>
</div>
<div class="slider js-slider">
<div class="slider__inner js-slider__inner">
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC1.png');left:0px; border-radius: 50%; border: 5px solid #864437; filter: drop-shadow(5px 3px 4px #864437);" ></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC2.png');left:-50%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437);" ></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC3.png'); left:-100%; border-radius: 50%; border: 5px solid #864437; "></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC4.png');left:-150%; border-radius: 50%; filter: drop-shadow(0 0 rem #864437);"></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC5.png');left:-200%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437);"></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-250%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437);"></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-300%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437);"></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-350%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437); "></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-400%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437); "></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-450%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437); "></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-500%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437); "></div>
</div>
<div class="slide js-slide">
<div class="slide__bg" style="background-image: url('CC6.png');left:-550%; border-radius: 50%; filter: drop-shadow(5px 3px 4px #864437);"></div>
</div>
</div>
</div>
<script>
function _getClosest(item, array, getDiff) {
var closest,
diff;
if (!Array.isArray(array)) {
throw new Error("Get closest expects an array as second argument");
}
array.forEach(function (comparedItem, comparedItemIndex) {
var thisDiff = getDiff(comparedItem, item);
if (thisDiff >= 0 && (typeof diff == "undefined" || thisDiff < diff)) {
diff = thisDiff;
closest = comparedItemIndex;
}
});
return closest;
}
function number(item, array) {
return _getClosest(item, array, function (comparedItem, item) {
return Math.abs(comparedItem - item);
});
}
function lerp(a, b, n) {
return (1 - n) * a + n * b
}
class Slider {
constructor(options = {}) {
this.bind()
this.opts = {
el: options.el || '.js-slider',
ease: options.ease || 0.1,
speed: options.speed || 1.5,
velocity: 15,
scroll: options.scroll || false
}
this.slider = document.querySelector('.js-slider')
this.sliderInner = this.slider.querySelector('.js-slider__inner')
this.slides = [...this.slider.querySelectorAll('.js-slide')]
this.slidesNumb = this.slides.length
this.rAF = undefined
this.sliderWidth = 0
this.onX = 0
this.offX = 0
this.currentX = 0
this.lastX = 0
this.min = 0
this.max = 0
this.centerX = window.innerWidth / 2
}
bind() {
['setPos', 'run', 'on', 'off', 'resize'].forEach((fn) => this[fn] = this[fn].bind(this))
}
setBounds() {
const bounds = this.slides[0].getBoundingClientRect()
const slideWidth = bounds.width
this.sliderWidth = this.slidesNumb * slideWidth
this.max = -(this.sliderWidth - window.innerWidth)
this.slides.forEach((slide, index) => {
slide.style.left = `${index * slideWidth}px`
})
}
setPos(e) {
if (!this.isDragging) return
this.currentX = this.offX + ((e.clientX - this.onX) * this.opts.speed)
this.clamp()
}
clamp() {
this.currentX = Math.max(Math.min(this.currentX, this.min), this.max)
}
run() {
this.lastX = lerp(this.lastX, this.currentX, this.opts.ease)
this.lastX = Math.floor(this.lastX * 100) / 100
const sd = this.currentX - this.lastX
const acc = sd / window.innerWidth
let velo =+ acc
this.sliderInner.style.transform = `translate3d(${this.lastX}px, 0, 0) skewX(${velo * this.opts.velocity}deg)`
this.requestAnimationFrame()
}
on(e) {
this.isDragging = true
this.onX = e.clientX
this.slider.classList.add('is-grabbing')
}
off(e) {
this.snap()
this.isDragging = false
this.offX = this.currentX
this.slider.classList.remove('is-grabbing')
}
closest() {
const numbers = []
this.slides.forEach((slide, index) => {
const bounds = slide.getBoundingClientRect()
const diff = this.currentX - this.lastX
const center = (bounds.x + diff) + (bounds.width / 2)
const fromCenter = this.centerX - center
numbers.push(fromCenter)
})
let closest = number(0, numbers)
closest = numbers[closest]
return {
closest
}
}
snap() {
const { closest } = this.closest()
this.currentX = this.currentX + closest
this.clamp()
}
requestAnimationFrame() {
this.rAF = requestAnimationFrame(this.run)
}
cancelAnimationFrame() {
cancelAnimationFrame(this.rAF)
}
addEvents() {
this.run()
this.slider.addEventListener('mousemove', this.setPos, { passive: true })
this.slider.addEventListener('mousedown', this.on, false)
this.slider.addEventListener('mouseup', this.off, false)
window.addEventListener('resize', this.resize, false)
}
removeEvents() {
this.cancelAnimationFrame(this.rAF)
this.slider.removeEventListener('mousemove', this.setPos, { passive: true })
this.slider.removeEventListener('mousedown', this.on, false)
this.slider.removeEventListener('mouseup', this.off, false)
}
resize() {
this.setBounds()
}
destroy() {
this.removeEvents()
this.opts = {}
}
init() {
this.setBounds()
this.addEvents()
}
}
const slider = new Slider()
slider.init()
</script>
</body>
</html>