forked from NickPiscitelli/Glider.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
128 lines (124 loc) · 4.61 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
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style type="text/css">@-ms-viewport{width:auto!important;}</style>
<link rel="stylesheet" type="text/css" href="glider.css" />
<script src="glider.js"></script>
<script>
window.addEventListener('load',function(){
document.querySelector('.glider').addEventListener('glider-slide-visible', function(event){
var glider = Glider(this);
console.log('Slide Visible %s', event.detail.slide)
});
document.querySelector('.glider').addEventListener('glider-slide-hidden', function(event){
console.log('Slide Hidden %s', event.detail.slide)
});
document.querySelector('.glider').addEventListener('glider-refresh', function(event){
console.log('Refresh')
});
document.querySelector('.glider').addEventListener('glider-loaded', function(event){
console.log('Loaded')
});
window._ = new Glider(document.querySelector('.glider'), {
slidesToShow: 1, //'auto',
slidesToScroll: 1,
itemWidth: 150,
draggable: true,
scrollLock: false,
dots: '#dots',
rewind: true,
arrows: {
prev: '.glider-prev',
next: '.glider-next'
},
responsive: [
{
breakpoint: 800,
settings: {
slidesToScroll: 'auto',
itemWidth: 300,
slidesToShow: 'auto',
exactWidth: true
}
},
{
breakpoint: 700,
settings: {
slidesToScroll: 4,
slidesToShow: 4,
dots: false,
arrows: false,
}
},
{
breakpoint: 600,
settings: {
slidesToScroll: 3,
slidesToShow: 3
}
},
{
breakpoint: 500,
settings: {
slidesToScroll: 2,
slidesToShow: 2,
dots: false,
arrows: false,
scrollLock: true
}
}
]
});
});
</script>
<!--
Used to frame the glider on the page
Not necessary for Glider.js
-->
<style type="text/css">
* {
box-sizing: border-box
}
html, body {
width: 100%;
overflow: hidden;
}
.glider-contain {
width: 90%;
max-width: 997px;
margin: 0 auto;
}
.glider-slide {
min-height: 150px;
}
.glider-slide img {
width: 100%;
}
</style>
</head>
<body>
<div class="glider-contain">
<div class="glider">
<div><img alt="Test" src="http://placehold.it/300x300?text=1"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=2"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=3"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=4"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=5"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=6"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=7"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=8"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=9"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=10"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=11"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=12"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=13"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=14"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=15"></div>
<div><img alt="Test" src="http://placehold.it/300x300?text=16"></div>
</div>
<button class="glider-prev">«</button>
<button class="glider-next">»</button>
<div id="dots"></div>
</div>
</body>
</html>