ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/www/src/scripts/index.script.php
Revision: 1.1
Committed: Sat Mar 20 19:58:11 2010 UTC (16 years, 7 months ago) by sf-dustfinger
Branch: MAIN
Log Message:
This is the first commit to add files needed for the PHP version of the website.

File Contents

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