-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
228 lines (203 loc) · 7.1 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
<!--
FUNCTIONALITY:
— Click any image
— Modal pops up
— Carousel opens on image selected (by index clicked)
— Arrows are available to continue navigating prev/next through slides
—— Slides are ordered same as the order on main page
-->
<!DOCTYPE html>
<html lang="en-GB">
<head itemscope itemtype="http://schema.org/WebSite">
<title>Modal Gallery</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="origin-when-cross-origin">
<script src="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/js/splide.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/css/splide.min.css">
<script src="assets/main.min.js" defer></script>
<link rel="stylesheet" href="assets/main.min.css">
</head>
<body
class="relative max-w-[1000px] mx-auto px-[20px] py-[100px]"
x-data="{
showModal: false,
}"
x-init="() => {
const slider = new Splide($refs.carousel, {
perPage: 1,
gap: 40
}).mount()
window.addEventListener('slidechange', e => {
slider.go(e.detail)
})
}"
>
<!-- MAIN CONTENT -->
<main
class=""
>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-full h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 1 -->
<img
src="https://source.unsplash.com/collection/3493233/1000"
alt=""
data-slide
x-data
@click="showModal = true; $dispatch('slidechange', 0)"
class="w-full h-full object-cover"
>
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-full text-center">
Some text here to split up the content blocks
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-full h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 2 -->
<img
src="https://source.unsplash.com/collection/3493233/1200"
alt=""
data-slide
x-data
@click="showModal = true; $dispatch('slidechange', 1)"
class="w-full h-full object-cover"
>
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-full text-center">
Some text here to split up the content blocks
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-6 h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 3 -->
<img
src="https://source.unsplash.com/collection/3493233/300"
alt=""
data-slide
x-data
@click="showModal = true; $dispatch('slidechange', 2)"
class="w-full h-full object-cover"
>
</div>
<div class="col-span-6 h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 4 -->
<img
src="https://source.unsplash.com/collection/3493233/800"
alt=""
data-slide
x-data
@click="showModal = true"
class="w-full h-full object-cover"
>
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-6 h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 5 -->
<img
src="https://source.unsplash.com/collection/3493233/600"
alt=""
data-slide
x-data
@click="showModal = true"
class="w-full h-full object-cover"
>
</div>
<div class="col-span-6 text-center">
Some text here to split up the content blocks
</div>
</section>
<section class="grid grid-cols-12 items-center gap-[20px] my-[20px]">
<div class="col-span-full h-[350px] overflow-hidden">
<!-- Click this to make modal carousel go to index 6 -->
<img
src="https://source.unsplash.com/collection/3493233/1500"
alt=""
data-slide
x-data
@click="showModal = true"
class="w-full h-full object-cover"
>
</div>
</section>
</main>
<!-- MODAL -->
<section
class="fixed inset-0 w-full h-full transition duration-200 bg-black/[.75] z-[20] flex overflow-y-scroll"
:class="{
'opacity-0 pointer-events-none ' : showModal === false,
'opacity-100 pointer-events-auto' : showModal === true,
}"
x-cloak
>
<div class="relative w-[80%] h-[80%] m-auto">
<button type="button" class="absolute top-[10px] right-[10px] p-[5px] text-white z-[20]"
@click="showModal = false"
>
Close
</button>
<!-- CAROUSEL -->
<div
class="splide w-full"
role="region"
aria-label="carousel"
tabindex="-1"
x-ref="carousel"
>
<div class="splide__track overflow-visible">
<div class="splide__list flex">
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/1000"
alt=""
class="w-full h-full object-cover"
>
</div>
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/1200"
alt=""
class="w-full h-full object-cover"
>
</div>
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/300"
alt=""
class="w-full h-full object-cover"
>
</div>
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/800"
alt=""
class="w-full h-full object-cover"
>
</div>
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/600"
alt=""
class="w-full h-full object-cover"
>
</div>
<div class="splide__slide">
<img
src="https://source.unsplash.com/collection/3493233/1500"
alt=""
class="w-full h-full object-cover"
>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>