Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Ustalenie intervalu
kiepski96
post 28.08.2014, 12:40:43
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);
    
    
    
});
Go to the top of the page
+Quote Post

Posty w temacie
- kiepski96   Ustalenie intervalu   28.08.2014, 12:40:43
- - trueblue   [HTML] pobierz, plaintext $(function(...   28.08.2014, 12:52:28


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 13:29