i'm having some difficulties getting my clearTimeout() to work. is there a master command that will clear any instance of timeout? or do i have to clear everyone individually?
Printable View
i'm having some difficulties getting my clearTimeout() to work. is there a master command that will clear any instance of timeout? or do i have to clear everyone individually?
javascript
i'll go into a little more detail of what is going on and mabe that wil help.
i have a slideshow and a menu. when you mouse over on the images in the menu, the slide show image will change to the appropriate image and pause the show. (clearTimeout()). when the mouse leaves the image, the slide show should be resumed.
the problem comes when i roll the mouse up and down the menu. the slide show resumes just fine, but instead of my 2.5 second delay on the image rotation, it goes though my images super quickly.
i'm thinking this is because i'm setting multiple instances of setTimeout() and that they arn't clearing properly.
i thought there was a command that was like a master clearTimeout() but i don't remember. i'm going to try a couple more things and if that doesn't work i'll post my code up here.
the code is rather big because i used some of the stuff that comes with dreamweaver to handle the image swaps. didn't want to post it all because its kinda big, but here is the part where the problems is.
Code://this preloads the images used in the slide show
function preloadImgs(){
if (slideshow==true){
for(var i=0;i<image.length;i++){
MM_preloadImages(image[i]);
}
}
else if (slideshow==false){
mytime = clearTimeout('randomImages()', delay);
}
}
//this begins the slide show
function randomImages(){
mytime = clearTimeout('randomImages()', delay);
if (slideshow==true){
if(counter == (image.length)){
counter = 0;
}
doit(counter++);
mytime = setTimeout('randomImages()', delay);
}
else if (slideshow==false){
mytime = clearTimeout('randomImages()', delay);
}
}
//this section of functions begins the stuff made by dreamweaver to handlde the image swapping
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
slideshow = true;
mytime = clearTimeout('randomImages()', delay);
randomImages();
}
oh come on, i find it hard to beleive no one has any suggestions...
Personally I don't have any suggestions because I suck with Javascript, but there are other people that might. Now can we please not bump threads this soon?