jquery - I need to make a fade in/out slider but I've hit a wall -



jquery - I need to make a fade in/out slider but I've hit a wall -

hey guys i've been using stack overflow sometime help teaching myself code think must missing basic principles since when seek find slider like, cannot figure out how works. tried create own figure out methods , rules little bit i've nail finish wall. i'm trying create slider starts out cycling through images , 1 time have working i'll figure out buttons , things.

anyway here's html test file:

<div id=slider> <img class="active" src="slider 1.jpg"/> <img src="slider 2.jpg"/> <img src="slider 3.jpg"/> </div>

the css:

#slider{ position: relative; } img { opacity: 0; position: absolute; }

and javascript:

$(document).ready(function(){ var repeater; var $active = $("img.active"); var $next = $active.next(); var $nonext = $("#slider:first-child"); $active.css('opacity','1'); function changeslide(){ if ($next) { $active.fadetoggle(); $next.fadetoggle(); $active.removeclass('active'); $next.addclass('active'); } else { $active.fadetoggle(); $active.removeclass('active'); $nonext.addclass('active'); $nonext.fadetoggle; } } function timer(){ changeslide(); repeater=settimeout(timer(), 1000); } timer(); });

basically tried create if there isn't image after current 1 default first image , run again. alter sec image active , remove class first image, fade in , out of first image endlessly. know i'm missing simple i'm relatively new language need help trying figure out?

thanks in advance guys!

pb084

jquery html css slider

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -