I have a banner with 3 images that I wish to fade in and fade out using jQuery. I have this part working fine with the following code:
$j(document).ready(function() { initBanner(); startLoop = setInterval(initBanner,50000); function initBanner(){ $j("##image1").delay(10000).fadeOut(1500, function(){ $j("##image2").fadeIn(1000, function(){ $j("##image2").delay(10000).fadeOut(1500, function(){ $j("##image3").fadeIn(1000, function(){ $j("##image3").delay(10000).fadeOut(1500, function(){ $j("##image1").fadeIn(1000); //inMotion = false; }); }); }); }); }); }
However below the banner are 3 links which have an image related to them. When I mouseenter on the buttons I want to change the image that is fading in and out to the image related to the button.
I have tried
clearInterval(startLoop)however this waits for the animation to finish before clearing. What I want is to be able to stop the animation immediatley and fade in the relative image.
Any ideas?