Compare - Gas Suppliers - Loans - Homes for Sale - Babb Fest

PDA

View Full Version : How can I do a photo slideshow with sequential and not random displaying pictures?


njman
Feb 1st 2008, 7:23 am
Hi, Im new here and really need some help on a javascript functions, as Im not too experienced with javascript code yet, and not quite sure how to approach this. I have a function to play a photo slide show with fade transitions. What can I use in place of Math.random so that the photos display in sequential order and not random order? Here is my existing code:


function doOn(_i,_n) {
eval("fade(document[\""+_i+"\"],_"+_n+".src)");
/* var next = ((_n+1)%11);
if(next==0)
next=1;
*/
var next = _n;
while(next == _n)
{
next = Math.round(1 * Math.random())+1;
}
if(timerv!=null)
clearTimeout(timerv);
timerv=setTimeout("doOn('"+_i+"',"+next+")",6000);
//alert("document[\""+_i+"\"].src="+_n+".src");
}


Thanks for any help you can give me. :)

NJ

jwlnewsome
Feb 1st 2008, 7:45 am
take a look at this
http://brainerror.net/scripts/javascript/blendtrans/demo.html

njman
Feb 1st 2008, 8:21 am
take a look at this

Hi jwlnewsome,

Thanks for the quick reply and the link. However, the link you gave me had to do mostly with transition and fade effects, which is cool, thanks, but I am mostly concerned with a javascript function to show sequential photos rather than random photos. I know it has something to do with this line, but just not sure exactly what.


next = Math.round(1 * Math.random())+1;


Thanks though. ;)

njman
Feb 1st 2008, 1:42 pm
Is there a replacement for Math.random that would give me sequential display of my photos rather than random display? I've researched on javascript websites and can't find anything.


Any help on this would be greatly appreciated. Thanks! :)

njman
Feb 13th 2008, 9:53 am
Anyone else have an idea about this?

Again, Im trying to have pics in this javascript slideshow display sequentially, not randomly.

Thank you very much for taking the time to help if you can!

NJ