-
Notifications
You must be signed in to change notification settings - Fork 11
/
demo.html
120 lines (117 loc) · 4.29 KB
/
demo.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Preload Plugin Demo</title>
<style type="text/css">
#wrap{
width: 960px;
margin: 0 auto 50px;
}
#info{
text-align: center;
margin: 50px 0 0;
}
.gallery{
height: 330px;
}
.photo{
height: 300px;
width: 300px;
float: left;
margin: 0 10px 0 0;
}
#photo-1{
background-image: url('http://farm2.static.flickr.com/1047/618175800_09d9f0d704.jpg');
}
#photo-1.hover{
background-image: url('http://farm3.static.flickr.com/2066/1997997751_4eed467567.jpg');
}
#photo-2{
background-image: url('http://farm3.static.flickr.com/2158/2433613083_9a737679bd.jpg');
}
#photo-2.hover{
background-image: url('http://farm4.static.flickr.com/3362/3252938723_64c586a31e.jpg');
}
#photo-3{
background-image: url('http://farm4.static.flickr.com/3435/3264729331_a769f2e67d.jpg');
}
#photo-3.hover{
background-image: url('http://farm4.static.flickr.com/3616/3522284481_a46cbc9486.jpg');
}
#photo-4{
background-image: url('http://farm4.static.flickr.com/3302/3491080879_fff3c754fc.jpg');
}
#photo-4.hover{
background-image: url('http://farm3.static.flickr.com/2754/4176113616_ee5799ed03.jpg');
}
#photo-5{
background-image: url('http://farm5.static.flickr.com/4033/4558063598_2288db4d39.jpg');
}
#photo-5.hover{
background-image: url('http://farm5.static.flickr.com/4053/4210707381_1b41574e05.jpg');
}
#photo-6{
background-image: url('http://farm5.static.flickr.com/4059/4437664124_c12239025a.jpg');
}
#photo-6.hover{
background-image: url('http://farm5.static.flickr.com/4044/4290957336_135e7c585a.jpg');
}
</style>
</head>
<body>
<div id="wrap">
<h1>
jQuery Preload Plugin Demo
</h1>
<p>
Try to hover on those images to see the differences.
You might need to clear the browser cache to make the script to take effects.
</p>
<h2>Without images preloaded</h2>
<p id="without-preload" class="gallery">
<span id="photo-1" class="photo"></span>
<span id="photo-2" class="photo"></span>
<span id="photo-3" class="photo"></span>
</p>
<h2>With images preload</h2>
<p id="with-preload" class="gallery">
<span id="photo-4" class="photo"></span>
<span id="photo-5" class="photo"></span>
<span id="photo-6" class="photo"></span>
</p>
<h3 id="info">
Demo provides by <a href="http://dreamerslab.com/">DreamersLab</a>
</h3>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.preload.min.js"></script>
<script type="text/javascript" charset="utf-8">
// wrap everything in document ready event
$( function(){
// hover effect - change background image
$( '.photo' ).hover( function(){
$( this ).addClass( 'hover' );
}, function(){
$( this ).removeClass( 'hover' );
});
// THE ACTUAL DEMO CODE
$.preload( 'http://farm3.static.flickr.com/2754/4176113616_ee5799ed03.jpg',
'http://farm5.static.flickr.com/4053/4210707381_1b41574e05.jpg',
'http://farm5.static.flickr.com/4044/4290957336_135e7c585a.jpg'
);
});
</script>
<script type="text/javascript" charset="utf-8">
// google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20960410-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>