-
Notifications
You must be signed in to change notification settings - Fork 0
/
thumbGallery.html
157 lines (148 loc) · 4.19 KB
/
thumbGallery.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>Scripted Pixels' Image gallery with Thumbnails</title>
<link rel="stylesheet" href="css/reset.css">
<style type="text/css">
/* setup the very basis for the document */
body {
text-align:center;
font-family:'Helvetica Neue';
font-weight: lighter;
font-size: 16px;
background: #FA4E06;
padding: 50px 0 0 0;
margin: 0 auto;
}
a {
color: #f0f0f0;
text-decoration: none;
}
.container {
clear: both;
display: block;
margin: 0 auto;
width: 100%;
min-width: 320px;
max-width: 600px;
position: relative;
text-align: center;
}
/* ANIMATION TRANSITION IF NEEDED */
.animate {
-webkit-transition: all 0.35s ease-in-out;
-moz-transition: all 0.35s ease-in-out;
-ms-transition: all 0.35s ease-in-out;
-o-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out;
}
.previewImageContainer {
display: block;
height: auto;
margin: 0 auto;
position: relative;
min-width: 300px;
max-width: 90%;
border: solid thin #fb6c29;
padding: 0 1rem;
}
/* -------------- SIZE 480 to 768 ----------------- */
@media only screen and (min-width: 700px) {
.previewImageContainer {
margin: 0 2rem;
}
}
/* -------------- SIZE 480 to 768 ----------------- */
@media only screen and (min-width: 700px) {
}
/* -------------- SIZE 480 to 768 ----------------- */
@media only screen and (min-width: 700px) {
}
.largepreviewImageContainer {
margin-top: 10px;
}
.largepreviewImageContainer, .largepreviewImageContainer .og-fullimg {
display: inline-block;
height: auto;
width: 100%;
text-align: center;
}
.largepreviewImageContainer .og-fullimg img {
height: 100%;
margin: 0 auto;
max-height: 100%;
width: 100%;
}
.smallpreviewImageContainer {
bottom: -1%;
display: inline-block;
height: auto;
left: 0;
position: relative;
text-align: center;
width: 100%;
margin: 10px auto;
}
.smallpreviewImageContainer .smallImage {
display: inline-block;
height: auto;
margin: 0 1.5%;
width: 29%;
}
.smallpreviewImageContainer .thumb {
width: 100%;
height: auto;
}
</style>
</head>
<body>
<div class="container">
<div class="previewImageContainer">
<div class="largepreviewImageContainer">
<div class="og-fullimg">
<img src="images/1Big.jpg" alt="" >
</div>
</div>
<div class="smallpreviewImageContainer">
<a class="smallImage" rel="images/1Big.jpg" href="#">
<img class="thumb" src="images/1.jpg">
</a>
<a class="smallImage" rel="images/2Big.jpg" href="#">
<img class="thumb" src="images/2.jpg">
</a>
<a class="smallImage" rel="images/3Big.jpg" href="#">
<img class="thumb" src="images/3.jpg">
</a>
</div>
</div>
</div> <!-- container -->
<!-- jQuery libraries -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/detectmobilebrowser.js"></script>
<script src="js/jquery.easing.1.3.js"></script>
<!-- TOUCH EVENTS -->
<script src="js/jquery.tappable.js"></script>
<!-- Let's do stuff when the Doc is ready, shall we -->
<script>
$(document).ready(function(){
// Assigns a click listener to all dom elements with a class of .smallImage
$(".smallImage").click(function() {
// Get the thumbnail's larger version. For the tutorial I use the same image.
// It looks for the image location in the thumbnails REL attribute
var image = $(this).attr("rel");
// Hide the large, full sized, image
$('.og-fullimg').hide();
// Edit the HTML of the large image to match the thumbnails larger version
$('.og-fullimg').html('<img src="' + image + '"/>');
// Lets fade that new large image back in
$('.og-fullimg').fadeIn('slow');
// return false to make sure the browser doesn't do anything 'funky' :)
return false;
// Done!
});
});
</script>
</body>
</html>