html5 - Simple jQuery slider repeating -
i'm trying make simple jquery slider infinitely repeats. i've put class "hidden" on item hidden, , class "featured" on item not hidden. plan make switch between them fade animation.
the problem can't figure out how add class "hidden" featured item, without being changed "featured" right after.
how do this? current jquery code:
var fadetime = 2500; var slideinterval = 5000; $("article.hidden").hide(); function aslider(){ $("article.featured").removeclass("featured").addclass("hidden") $("article.hidden").removeclass("hidden").addclass("featured").fadein(fadetime); }; setinterval(aslider, 5000);
thanks,
marius
the error inside code:
when run first line:
$("article.featured").removeclass("featured").addclass("hidden")
then run second you act on 1 have changed!
$("article.hidden").removeclass("hidden").addclass("featured").fadein(fadetime);
here solution: http://jsfiddle.net/madthew/39w8z/3/
Comments
Post a Comment