![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 250 Pomógł: 11 Dołączył: 20.01.2014 Ostrzeżenie: (0%) ![]() ![]() |
Witajcie.
Napisałem preloader obrazków na stronie:
Problem polega na tym że często się ten kot wykonuje tylko do 25% lub 49%. Mimo ze zmienna images zawiera wszystkie obrazki ze strony i na samej stronie widac ze wszystkie się wczytały. Jak zaczne odswiezac stronę to w koncu przejdzie do 100%. Co tu jest nie tak? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 6 806 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Kod $('body').append('<div class="loader2"><img src="http://page4u.waw.pl/shop/712.gif"/><div class="loader_box"> </div></div>');
var images=$('img'); var step = 100/images.length; var count=0; for(var i=0;i<images.length;i++){ var img=document.createElement('img'); img.onload=function(){ count++; $('.loader_box').html(Math.round(count*step)+"%<br>") if(count==images.length){ $('.loader2').fadeOut(); } } img.src=$(images[i]).attr('src'); } |
|
|
![]() ![]() |
![]() |
Aktualny czas: 3.10.2025 - 13:23 |