I'm delving into the world of jQuery to create some captivating animations. Currently, I've been tasked with an assignment involving images that expand, contract, change opacity, and eventually hide.
Below is my code snippet:
function play_pic1()
{
var div = $("#img");
div.animate({width:0},2000);
div.animate({width:1100,opacity:0},4000);
div.animate({opacity:1},4000);
div.hide(4000);
}
$(document).ready(function(){
play_pic1();
play_pic1();
});
The issue arises when trying to work with multiple images; the second image remains static while the first one animates as intended.
Despite attempting to implement loops and functions, the problem persists. Any guidance on resolving this dilemma would be greatly appreciated.