ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/www/src/scripts/index.script.php
Revision: 1.2
Committed: Fri Apr 9 16:22:03 2010 UTC (16 years, 6 months ago) by sf-dustfinger
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +4 -2 lines
Log Message:
Changed the wording and added bold on the download page at LinuxLemoner's advice.

File Contents

# Content
1 <script type='text/javascript' src='scripts/jquery-1.4.2.min.js'></script>
2
3 <script type='text/javascript'>
4
5 var images = new Array(
6 "images/dragon1.png",
7 "images/monsters.png",
8 "images/treasure.png",
9 "images/exploring.png"
10 );
11
12 var descriptions = new Array(
13 "imageDescription1",
14 "imageDescription2",
15 "imageDescription3",
16 "imageDescription4"
17 );
18
19 var currentlyShownSlot = 1; //The number one image slot starts out displayed.
20 var imageIndex = 0;
21 var moving = false; //Flag to prevent double clicking from messing up the animation.
22
23 //Wait until the page loads and then set up dynamic events for the page elements.
24 $(document).ready(function()
25 {
26 //The action for the left image scroll arrow.
27 $('#leftArrow').click(function()
28 {
29 if(moving==true)
30 {
31 return;
32 }
33 moving = true;
34 var oldIndex = imageIndex;
35 imageIndex--;
36 if(imageIndex<0)
37 {
38 imageIndex = images.length-1;
39 }
40 $("#"+descriptions[oldIndex]).fadeOut('slow',function() {$("#"+descriptions[imageIndex]).fadeIn();});
41
42 //First set up the other image and put it in place for sliding in.
43 if(currentlyShownSlot==1)
44 {
45 //Then we need to put the second image in place off to the left of the image box.
46 $("#featuredImage2").attr("src",images[imageIndex]);
47 $("#featuredImage2").css("left", "-800px");
48 $("#featuredImage2").animate({"left": "+=800px"}, "slow");
49 $("#featuredImage1").animate({"left": "+=800px"}, "slow", function()
50 {
51 if(currentlyShownSlot==1)
52 {
53 currentlyShownSlot = 2;
54 }
55 else
56 {
57 currentlyShownSlot = 1;
58 }
59 moving = false;
60 });
61 }
62 else
63 {
64 //Then we need to put the first image in place off to the left of the image box.
65 $("#featuredImage1").attr("src",images[imageIndex]);
66 $("#featuredImage1").css("left", "-800px");
67 $("#featuredImage1").animate({"left": "+=800px"}, "slow");
68 $("#featuredImage2").animate({"left": "+=800px"}, "slow", function()
69 {
70 if(currentlyShownSlot==1)
71 {
72 currentlyShownSlot = 2;
73 }
74 else
75 {
76 currentlyShownSlot = 1;
77 }
78 moving = false;
79 });
80 }
81 });
82
83 //The action for the right image scroll arrow.
84 $('#rightArrow').click(function()
85 {
86 if(moving==true)
87 {
88 return;
89 }
90 moving = true;
91 //Hide current image description
92 var oldIndex = imageIndex
93 imageIndex++;
94 if(imageIndex>=images.length)
95 {
96 imageIndex = 0;
97 }
98 $("#"+descriptions[oldIndex]).fadeOut('slow',function() {$("#"+descriptions[imageIndex]).fadeIn();});
99 //First set up the other image and put it in place for sliding in.
100 if(currentlyShownSlot==1)
101 {
102 //Then we need to put the second image in place off to the right of the image box.
103 $("#featuredImage2").attr("src",images[imageIndex]);
104 $("#featuredImage2").css("left", "800px");
105 }
106 else
107 {
108 //Then we need to put the first image in place off to the right of the image box.
109 $("#featuredImage1").attr("src",images[imageIndex]);
110 $("#featuredImage1").css("left", "800px");
111 }
112 $("#featuredImage1").animate({"left": "-=800px"}, "slow");
113 $("#featuredImage2").animate({"left": "-=800px"}, "slow", function()
114 {
115 if(currentlyShownSlot==1)
116 {
117 currentlyShownSlot = 2;
118 }
119 else
120 {
121 currentlyShownSlot = 1;
122 }
123 moving = false;
124 });
125 });
126 });
127
128 </script>