/
start.html
61 lines (46 loc) · 1.62 KB
/
start.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
<!DOCTYPE html>
<html>
<head>
<title>jQuery Gallery</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="fancybox/jquery.fancybox.css">
</head>
<body>
<div class="container clearfix">
<div class="gallery clearfix">
<h1>jQuery Gallery</h1>
<div class="previews">
<a href="#" class="selected" data-full="images/top1large.jpg"><img src="images/top1small.jpg" /></a>
<a href="#" data-full="images/top2large.jpg"><img src="images/top2small.jpg" /></a>
<a href="#" data-full="images/top3large.jpg"><img src="images/top3small.jpg" /></a>
<a href="#" data-full="images/top4large.jpg"><img src="images/top4small.jpg" /></a>
<a href="#" data-full="images/top5large.jpg"><img src="images/top5small.jpg" /></a>
</div>
<div class="full">
<!-- first image is viewable to start -->
<img src="images/top1large.jpg" />
</div>
</div>
</div>
<script src="jquery.js"></script>
<script src="fancybox/jquery.fancybox.js"></script>
<script>
$(document).ready(function(){
$('.previews a').on('click', function(){
$('.previews a').removeClass('selected');
$(this).toggleClass('selected');
// Get thumbnail for gallery
var largephotos = $(this).attr('data-full');
$('.full img').attr('src',largephotos);
$('.full img').hide().load(function() {
$('.full img').fadeIn(800);
});
});
$('.full img').on('click', function(){
var largeimage = $(this).attr('src');
$.fancybox.open(largeimage);
});
});
</script>
</body>
</html>