看看下面的鏈接,因爲它是一個「裝載機」所需要的代碼,造型和佈局。
我已經使用的代碼和它的作品100%
你需要一個div您的網頁上:
<div class="modal"></div>
的DIV了CSS樣式的:
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
speak for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba(255, 255, 255, .8)
url('http://sampsonresume.com/labs/pIkfp.gif')
50% 50%
no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modal {
display: block;
}
而且然後最後一點javascript來啓動和停止(隱藏並顯示)加載器:
START:
$(this).addClass("loading");
STOP:
$(this).removeClass("loading");
來源:http://jsfiddle.net/jonathansampson/VpDUG/170/