yükleniyor gibi görünüyor olacak spinner görüntü için src ayarlayabilirsiniz size çağrı, karmaşık bir mesele haline gelir. Bazıları yeni bir sayfa yüklenmeye başladığında tüm GIF animasyonlarını durdurur. Temel olarak jQuery'niz varsa ve spin.js kütüphanesini indirirseniz böyle bir şeye gelir.
burada çözümü çalışma bakınız:
<style>
#loading {
display:none;
position:absolute;
left:0;
top:0;
z-index:1000;
width:100%;
height:100%;
min-height:100%;
background:#000;
opacity:0.8;
text-align:center;
color:#fff;
}
#loading_anim {
position:absolute;
left:50%;
top:50%;
z-index:1010;
}
</style>
<div id="loading"><div id="loading_anim"></div></div>
<a href="http://pangoo.it" class="mylinkclass withanimation">link</a>
<script>
$(function() {
$(".withanimation").click(function(e) {
e.preventDefault();
$("#loading").show();
var url=$(this).attr("href");
setTimeout(function() {
setTimeout(function() {showSpinner();},30);
window.location=url;
},0);
});
});
function showSpinner() {
var opts = {
lines: 15, // The number of lines to draw
length: 3, // The length of each line
width: 4, // The line thickness
radius: 30, // The radius of the inner circle
rotate: 0, // The rotation offset
color: '#fff', // #rgb or #rrggbb
speed: 2, // Rounds per second
trail: 70, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
$('#loading_anim').each(function() {
spinner = new Spinner(opts).spin(this);
});
}
</script>
bazı tarayıcılarda donabilir animasyonlu (GIF) animasyon kullanırsanız
http://jsfiddle.net/7aJyP/
. Spin.js kitaplığını kullandım (
http://fgnass.github.com/spin.js/). GIF'ler donarken javascript animasyonu çalışıyor gibi görünüyor.
Lütfen TÜM tarayıcılarla test edin!
web sayfasının üzerinde herhangi bir kontrol yoksa? – David