These instructions will show you how to add a JavaScript slider to your pages.
In order for this slider to work, you will need a copy of JQuery and a copy of the slider JavaScript code. You can download them both here (Options + Click to download the files):
Use the script tag to add the JavaScript to the html documents.
<script src="js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/slideshow.js" type="text/javascript" charset="utf-8"></script>
The basic structure you should use for your HTML is a series of div tags.
<div id="gallery">
<div class="slides">
<div class="slide"><img src="" alt="" width="" height="" /></div>
</div>
</div>
Here's breakdown:
<div id="menu">
<a href="#previous" class="previous">previous</a>
<a href="#next" class="next">next</a>
</div>
/* Styles for the Slides */
/* In order to make the slide show work, you only need to include these styles */
#gallery {
overflow: hidden; /* This makes sure that the extra photos are hidden */
width: 960px; /* This should be set to the width of your
gallery ( the part that you actually want viewable)
Make sure to change this value to the width you want visible */
}
.slide
float: left; /* This makes sure that all our images display in a row */
}
View the style sheet for slider demo page to see how to style the menu buttons. The CSS code is well-commented. Make sure to use a different image for the actual buttons.
The following changes are optional. You must open and edit the slideshow.js file to make these changes.
You can adjust how slow or fast each slide moves.
The slider moves automatically every 5 seconds. You can turn off this behavior.
You can change how quickly each slide auto scrolls.
When the page loads, the slider is set to jump to a random image in the slideshow. You can turn this off.
To change these options, find the following code at the top of the slideshow.js file:
/*** Slideshow Options ****/
/* Sliding Speed
* Changes the rate at which the images slide. Bigger number means slower
*/
var slideSpeed=600;
/* Automatic Sliding
* Sets whether or not the slides scroll automatically. Set to false to turn off.
*/
var autoSlide=true;
/* Automatic Sliding Timer
* Sets how much time between each automatic slide. Number is miliseconds (5000 = 5 secs).
*/
var autoSlideTimer = 5000;
/* Random Image
* Sets whether or not a random image will be chosen when the page loads. If false, the first image will show.
*/
var loadRandom = true;
Change only the highlighted sections of code.