我想要实施一个解决方案,其中:
我试过了:
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>
Run Code Online (Sandbox Code Playgroud)
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');
});
Run Code Online (Sandbox Code Playgroud)
这是我正在研究的jsfiddle:
http://jsfiddle.net/rwone/Y9CQ4/
谢谢.