| The New Slideshow 1.7 Setup |
|
|
|
| Written by weekendclimber | ||||
| Wednesday, 05 April 2006 | ||||
Page 2 of 2 Editing the JavascriptNow, with the main picture, description division, thumbnail division, and right and left (or up and down) links placed on your page, it's time to setup the javascript variables in the program. Be careful here, most of these have changed since the prior version of the program. Open up the slide show script in your text editor and edit the variables' values according to the following descriptions:
Combining the HTML and JavascriptOnce the variables have been edited according to your needed setup, upload the javascript file to your server and remember the location of where you have placed it. Now, we need to once again edit your html page that will utilize the script. First, we need to declare the names of the images using the javascript array 'imgTxt' which will be added within the `HEAD' section of your HTML document. Also, if you are using the descriptions feature, you can add a second array that holds these descriptions, called 'imgDesc'. Also, we need to add a little line to point to the script, like such: <HEAD><SCRIPT TYPE="text/javascript">var imgTxt = new Array ("pic1", "pic2", etc... );var imgDesc = new Array ( "desc1", "desc2", etc... );</SCRIPT><SCRIPT TYPE="text/javascript" SRC="/path/to/slideshow.js"></HEAD>It is very important the the declaration of the javascript file comes after the declaration of the two arrays that holds the picture names and descriptions. These arrays are used in the program, so if they are declared after the javascript file is loaded, an error will occur, and that makes everything rather unpleasant. Putting all togetherNow that everything has been pieced together you should be able to load up the page and test it. Make sure that both the thumbnail scrolling works and that the full-size images and the descriptions load after clicking the appropriate thumbnail image. Now that you have setup the script, it's even easier to add additional slide show pages. Just add the two script tags (one to declare the `imgTxt' and 'imgDesc' arrays and the other to point to the source script) into the `HEAD' section of the new page, add the `onload' function to the `body' tag along with the thumbnail and description divisions. This should make it real easy to add new slideshows whenever you snap new pictures and want to share them. |
||||






