forked from markcellus/carousel-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcarousel-with-thumbnails.html
More file actions
55 lines (48 loc) · 1.37 KB
/
carousel-with-thumbnails.html
File metadata and controls
55 lines (48 loc) · 1.37 KB
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
<html>
<head>
<style>
.carousel-image {
width: 400px;
height: 200px;
display: none;
}
.carousel-image-active {
display: block;
margin-bottom: 5px;
}
.carousel-thumb {
width: 25px;
height: 25px;
background-color: red;
display: inline-block;
cursor: pointer;
}
</style>
</head>
<body>
<p>
Click on one of the red squares below to interact with the photos.
</p>
<div class="carousel">
<img class="carousel-image" src="http://www.gstatic.com/webp/gallery/1.jpg" />
<img class="carousel-image" src="http://www.gstatic.com/webp/gallery/2.jpg" />
<img class="carousel-image" src="http://www.gstatic.com/webp/gallery/3.jpg" />
<div class="carousel-thumbs">
<div class="carousel-thumb"></div>
<div class="carousel-thumb"></div>
<div class="carousel-thumb"></div>
</div>
</div>
<script src="../dist/carousel.js"></script>
<script>
var thumbnails = document.getElementsByClassName('carousel-thumb');
var carousel = new Carousel({
panels: document.getElementsByClassName('carousel-image'),
thumbnails: thumbnails,
panelActiveClass: 'carousel-image-active'
});
// show second thumbnail on load
carousel.goTo(1);
</script>
</body>
</html>