「ローダー」に必要なコード、スタイリング、およびレイアウトであるため、次のリンクを確認してください。
コードを使用しましたが、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 を少し追加します。
始める:
$(this).addClass("loading");
止まる:
$(this).removeClass("loading");
ソース: http://jsfiddle.net/jonathansampson/VpDUG/170/