-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.js
executable file
·77 lines (54 loc) · 1.95 KB
/
all.js
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
<script type="text/javascript">
var aImages = new Array();
var aURL = new Array();
var aArtists = new Array();
var iPrev = -1;
var iRnd = -1;
aImages[0] = "background image/01.jpg";
aImages[1] = "background image/02.jpg";
aImages[2] = "background image/03.jpg";
aImages[3] = "background image/04.jpg";
$(document).ready(function() {
/* Define the function that triggers to fade in the background as soon as the image has loaded */
$("img#bg").load(function()
{
/* Fade in during 3 seconds */
$("img#bg").fadeTo(1000,1);
/* Animate the picture description during 1 second */
setTimeout(function() { $("#image_description").animate({right: '+=150'}, 1000) }, 1000);
/* Set the timeout to fade out the image and the description after 10 seconds*/
setTimeout(function()
{
$("#image_description").animate({right: '-=150'}, 1000);
$("img#bg").fadeOut(1000);
/* Load the next image after 4 seconds */
setTimeout(LoadImages,1000);
}
,7000);
}
)
/* Start the slideshow one second after the page is ready */
setTimeout(LoadImages,1000);
});
function LoadImage(iNr)
{
/* Assign the new image to the background */
$("img#bg").attr("src", aImages[iNr]);
/* Assign the artist name to the description */
$("#image_artist").html(aArtists[iNr]);
/* Assign the image url to the description */
$("a#image_url").attr("href", aURL[iNr]);
$("a#image_url").html("");
};
function LoadImages()
{
/* Select a random image number and make sure this is not equal to the previous image */
while(iPrev == iRnd)
{
iRnd = Math.floor(Math.random()*aImages.length);
}
/* Show the selected image */
LoadImage(iRnd);
iPrev = iRnd;
};
</script>