私はソリューションを実装したいと思っています:
- div #content のコンテンツが読み込まれている間、
- div #content を非表示、
- div #loading を表示、
- 次に、div #content が読み込まれると、
- div #loading を非表示、
- div #content でフェードイン
私が試してみました:
html:
<div id="content">
<!--this stuff takes a long time to load-->
<img src="http://lorempixel.com/1920/1920/">
</div>
<div id="loading">
<!-- this is the loading gif -->
<img src="http://lorempixel.com/400/200/">
</div>
js:
// when user browses to page
$('#content').hide();
$('#loading').show();
// then when div #content has loaded, hide div #loading and fade in div #content
$('#content').bind('load', function() {
$('#loading').hide();
$('#content').fadeIn('slow');
});
ここに私が取り組んでいるjsfiddleがあります:
http://jsfiddle.net/rwone/Y9CQ4/
ありがとうございました。