-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path25_carousel.html
129 lines (103 loc) · 2.33 KB
/
25_carousel.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
<!DOCTYPE html>
<html>
<head>
<title>DSI Data Viz</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
font-family: "Scene Pro", "Helvetica", sans-serif;
}
#carousel {
width: 1008px;
margin: 0 auto;
margin-top: 60px;
}
#carousel .button {
cursor: pointer;
margin-top: 60px;
font-size: 40px;
}
#carousel .button-prev {
float: left;
margin-left: -40px;
}
#carousel .button-next {
float: right;
margin-right: -40px;
}
#carousel .carousel-wrapper {
width: 1008px;
height: 240px;
overflow: hidden;
position: relative;
}
#carousel .carousel-item {
float: left;
background: #eaebeb;
}
#carousel .carousel-item,
#carousel .carousel-item img {
width: 322px;
height: 181px;
}
#carousel .carousel-item a {
display: block;
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
text-decoration: none;
}
#carousel .carousel-item span {
display: block;
position: absolute;
top: 182px;
left: 0;
width: 322px;
height: 181px;
padding-top: 80px; /* ugly text hand centering */
text-align: center;
background: rgba(234, 235, 235, 0.5);
color: black;
-webkit-transition: top 300ms;
transition: top 300ms;
}
#carousel .carousel-item:hover span {
top: 0;
}
</style>
</head>
<body>
<div id="carousel">
<div class="button button-prev">⟨</div>
<div class="button button-next">⟩</div>
<div class="carousel-wrapper">
</div>
</div>
<div id="filter">FILTER!</div>
<div id="reset">RESET!</div>
<script type="text/javascript" src="lib/live.js"></script>
<script type="text/javascript" src="lib/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="25_carousel.js"></script>
<script type="text/javascript">
// builds carousel
var carousel = new Carousel({
"wrapper": $("#carousel >.carousel-wrapper"),
"buttonPrev": $("#carousel > .button-prev"),
"buttonNext": $("#carousel > .button-next")
});
// filter examples
$("#filter").on("click", function() {
carousel.filter(function(item) {
return item.areaOfDSI == "new-ways-of-making";
});
});
$("#reset").on("click", function() {
carousel.filter(null);
});
</script>
</body>
</html>