PDA

View Full Version : Ultimate Fade - once through and page change



jscheuer1
01-26-2006, 08:29 PM
This post is the result of a special request. It will add to the modifications found here (http://www.dynamicdrive.com/forums/showthread.php?t=6567) to enable the slideshow to switch to another page after it has run through once. The above link shows the modifications for a one time only slideshow option. Add to it these changes -

For the function fadeshow() make this line:


function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, onetime, displayorder){

look like so:


function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, onetime, url, displayorder){

Add this line (shown in red):


this.flag=0
this.url=url

below the previously added 'flag' line.

In the fadepic(obj) function, where we previously had:


if(obj.flag&&obj.onetime)
return;
if(obj.nextimageindex==obj.postimages.length-1)
obj.flag=1

Make it like so:


if(obj.flag&&obj.onetime&&obj.url!=='0'){
setTimeout('window.location.href="'+obj.url+'"', obj.delay)
return;
}
else if(obj.flag&&obj.onetime)
return;
if(obj.nextimageindex==obj.postimages.length-1)
obj.flag=1

Now we can have a parameter for the page we want to switch to in each slideshow call:


//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), onetime, url, optionalRandomOrder)
new fadeshow(fadeimages, 140, 225, 0, 3000, 1, 1, "some.htm", "R")
new fadeshow(fadeimages2, 140, 225, 10, 5000, 0, 0, 0)

In the above, the first call has a url associated with it, the second one uses a 0 to represent no url to switch to.