Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CSS][HTML][JavaScript]Wordpress preloader
atom90
post
Post #1





Grupa: Zarejestrowani
Postów: 172
Pomógł: 0
Dołączył: 11.06.2014

Ostrzeżenie: (0%)
-----


Witam.

Przygotowalem progressbar do wczytywania strony na podstawie znalezionego przykladu:


https://jsfiddle.net/zg650281/38/


Chcialem go zaimplementowac na stronie z wordpressem, ale strona pojawia sie wczesniej niz progress bar, a pasek nie laduje sie.


Moze ma ktos pomysl co robie zle?

Strona:
http://small-atom.pl/

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
aras785
post
Post #2





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

Ostrzeżenie: (0%)
-----


Cześć,

nie mam za bardzo jak tego przetestować ale myślę, że to pomoże:

w pliku zmień /wp-content/themes/atomix/js/atom.js:


  1. setTimeout(function(){
  2. $('#main-container').fadeOut(300);
  3. }, time);


na

  1. setTimeout(function(){
  2. $('.preloader-wrap').fadeOut(300);
  3. }, time);


daj znać czy działa (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
atom90
post
Post #3





Grupa: Zarejestrowani
Postów: 172
Pomógł: 0
Dołączył: 11.06.2014

Ostrzeżenie: (0%)
-----


No tak, ale sam sobie pomieszalem. To juz do przodu jestesmy, jeszcze kwestia czemu animacja sie nie odpala (IMG:style_emoticons/default/smile.gif)

Edit

Dalem opoznienie seckundowe na ten skrypt wtedy zdazy polapac sie i naliczyc czas, ale zobaczymy czy to bedzie lepiej dzialac (rzeczywiscie gdy strona bedzie ladowala sie dluzej)

Ale prosil bym aby zerknac na to czy to dobre rozwiazanie czy jednak to nie jest dobre

Kod
//Page loader


setTimeout(function(){
    var width = 100,
        perfData = window.performance.timing, // The PerformanceTiming interface represents timing-related performance information for the given page.
        EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart),
        time = parseInt((EstimatedTime/1000)%60)*100;

    // Loadbar Animation
    $(".loadbar").animate({
      width: width + "%"
    }, time);

    // Loadbar Glow Animation
    $(".glow").animate({
      width: width + "%"
    }, time);

    // Percentage Increment Animation
    var PercentageID = $("#precent"),
            start = 0,
            end = 100,
            durataion = time;
            animateValue(PercentageID, start, end, durataion);

    function animateValue(id, start, end, duration) {

        var range = end - start,
          current = start,
          increment = end > start? 1 : -1,
          stepTime = Math.abs(Math.floor(duration / range)),
          obj = $(id);

        var timer = setInterval(function() {
            current += increment;
            $(obj).text(current + "%");
          //obj.innerHTML = current;
            if (current == end) {
                clearInterval(timer);
            }
        }, stepTime);
    }

    // Fading Out Loadbar on Finised
    setTimeout(function(){
      $('.preloader-wrap').fadeOut(300);
    }, time);
}, 1000);
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 22.08.2025 - 23:50