jquery - How will you loop the fadeIn animation? -
i new jquery.
i want animation play continuously. plays once , stops. sorry placed wrong code. should below
html
<div id="imageslide"> <ul id="carousel"> <li><img src="img/apart1.png" alt="excellent apartment"></li> <li><img src="img/apart2.png" alt="beautiful apartment"></li> <li><img src="img/apart3.png" alt="brilliant apartment"></li> <li><img src="img/apart4.png" alt="nice apartment"></li> <li id="last"><img src="img/apart5.png" alt="marvellous apartment"></li> </ul> </div>
jquery
$(document).ready(function(){ $("li").slice(1).addclass("hide"); function anim(elm) { elm.delay(1500).fadein(1500, function() { anim($(this).next()); }); } anim($("#carousel li:first")); });
thanks in advance.
this should going in right direction:
jquery
$(document).ready(function(){ var images = $('li img').length; function shownext(target_num) { var currimg = target_num; var nextimg = (target_num === (images-1) ? 0 : target_num+=1); $('li img').eq(currimg).fadeout('slow', function(){ $('li img').eq(nextimg).fadein('slow', function(){ shownext(nextimg); }); }); } settimeout(function(){ shownext(0); }, 1000); });
html
<div id="imageslide"> <ul id="carousel"> <li> <img src="img/apart1.png" alt="excellent apartment"> </li> <li> <img src="img/apart2.png" alt="beautiful apartment" style="display:none;"> </li> <li> <img src="img/apart3.png" alt="brilliant apartment" style="display:none;"> </li> <li> <img src="img/apart4.png" alt="nice apartment" style="display:none;"> </li> <li id="last"> <img src="img/apart5.png" alt="marvellous apartment" style="display:none;"> </li> </ul> </div>
Comments
Post a Comment