Hi, I have some rotating banners, I rotate them via timeouts...
So I have an object BanRotate, that stores the desired timeouts, this work fine.
However, I want to load a new page via AJAX, clear the old timeouts and assign new ones.
Getting the page works, creating new timeouts is working, but I seem unable to clear the old timeouts and they seem to still run.
I have this code
But it isn't' clearing the timeouts?
Any ideas why?
Thanks,
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
Code:
// add banner rotate timeout helper
function addBannerRotate(page,pos,ord,timeout)
{
var rot = "rotateBanner('"+page+"','"+pos+"',"+ord+")";
BanRotate[pos][ord] = setTimeout(rot,(timeout * 1000));
}
So I have an object BanRotate, that stores the desired timeouts, this work fine.
However, I want to load a new page via AJAX, clear the old timeouts and assign new ones.
Getting the page works, creating new timeouts is working, but I seem unable to clear the old timeouts and they seem to still run.
I have this code
Code:
// clear any timeouts
$(BanRotate).each(function(i,val){
$(val).each(function(i2,val2){
clearTimeout(val2);
});
});
But it isn't' clearing the timeouts?
Any ideas why?
Thanks,
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music