This is the slideshow that we used:
http://www.littlewebthings.com/projects/blinds/
and this is the JS file:
http://www.littlewebthings.com/projects/blinds/js/jquery.blinds-0.9.js
However, this slideshow doesn’t have a setting that makes it go through each image automatically. You still have to click on the numbers below it to see the images. Does anybody know what to add into the javascript code to make it go through each image automatically?
Thanks!
This solution uses closures and recursion.
What we are doing here is exposing the inner function
timeroutside of the function in which it was defined (SlideChanger). This function (timer) has access to the variables defined inside ofSlideChanger(indexandmaxindex).Now that we have set up the variables in the enclosing environment and a function to return to the caller, we can set up the logical engine in
logic. Whenlogicis run, it usesindexandmaxindexto determine which slide should be shown next, shows the slide, and schedules itself to be run again in the future.When called, the returning function calls
logicto get the ball rolling. Thenlogicrepeats indefinitely by scheduling itself to run in the future each time it is run.So, to summarize, we call
SlideChangerwith a numeric argumentx. It returns a function that, after being called, will change the slide everyxseconds.Another way to write the same concept.
JavaScript is a nice language with many functional programming constructs such as higher order functions (functions that either create functions or accept functions as parameters) and anonymous functions. For more info see http://www.ibm.com/developerworks/web/library/wa-javascript.html