Jump to content

Load 'next' and 'previous' photos from a dir.


kuran

Recommended Posts

Hello everyone!This is my site.. http://www.wimtubbax.be/photography/ Due to some great help from a lot of posters here, I managed to get the javascript that put the photographs on the background of the page..Would it be possible to use this same javascript, but change it so that I have a 'next' and 'previous' button, that when clicked take the 'next' photograph out of a directory? Or maybe I could make the images that load as the background clickable? But I don't think thats possible...Thanks in advance for any tips... comments, or whatever.. : )

Link to comment
Share on other sites

You cannot get the images in the server folder using javascript.Alternative [using javascript ] is to make a list of all the images and change the image holder sourse when "next" or "back" button is clickedJAVASCRIPTvar photos=new Array() //globalvar which=0 //globalphotos[0]="img1.jpg"photos[1]="img2.jpg"photos[2]="img3.jpg"photos[3]="img4.jpg"photos[4]="img5.jpg"photos[5]="img6.jpg"photos[6]="img7.jpg"function backward(){if (which>0){which--document.images.photoslider.src=photos[which]}}function forward(){if (which<photos.length-1){which++document.images.photoslider.src=photos[which]}}HTML<img src="photos[0]" name="photoslider"><a href="#" onClick="backward();return false;"> Previous Slide</a><a href="#" onClick="forward();return false">Next Slide</a>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...