![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 233 Pomógł: 0 Dołączył: 22.02.2010 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
Stworzyłem slider, który pokazuje po kolei divy co jakiś czas. Jest za to odpowiedziany dany interwał, który ustalę. Lecz niestety interwał również jest zanim się pokaże pierwszy div, trzea czekać na niego 4 sekundy. Jak przerobić kod, aby po wejściu na stronę slider od razu pokazał diva bez interwału ? Kod var intervalId;
$(function(){ function cycleImage(){ var onLastLi = $("#thumbs li:last").hasClass("current"); console.log(onLastLi); var currentImage = $("#thumbs li.current").html(); var targetImage = $('div.feature-photo'); console.info(currentImage); console.info(targetImage); $(targetImage).hide().html(currentImage).fadeIn(); var currentLi = $("#thumbs li.current"); currentLi.removeClass("current"); if(onLastLi){ $("#thumbs li:first").addClass("current"); } currentLi.next().addClass("current"); }; intervalID = setInterval(cycleImage, 4000); }); |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 13:29 |