를로드 할 것처럼 보일 회 전자 이미지에 대한 SRC를 설정할 수 있습니다 전화, 그것은 복잡한 문제가된다. 새 페이지로드가 시작될 때 일부 GIF 애니메이션이 중지됩니다. 기본적으로 jQuery가 있고 spin.js 라이브러리를 다운로드하면 이런 식으로됩니다.
여기 솔루션을 작업 방법을 참조하십시오 :
<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>
일부 브라우저에서 정지 될 수 있습니다 애니메이션 (GIF) 애니메이션을 사용하는 경우
http://jsfiddle.net/7aJyP/
. spin.js 라이브러리 (
http://fgnass.github.com/spin.js/)를 사용했습니다. GIF가 정지되면 자바 스크립트 애니메이션이 작동하는 것처럼 보입니다.
모든 브라우저에서 테스트하십시오!
당신이 웹 페이지에 대한 제어가없는 경우? – David