我有一个HTML页面,其中包含外部javascript,主要是facebook插件和其他社交插件,这会减慢整个页面的加载时间。我有一个javascript加载器,除了" Loading"和AJAX加载器gif,直到整个页面完全加载。
这是脚本:
<script>
var tid = setInterval(function() {
$(".bc").css("display", 'none'); // .bc is my body , so here i hided
// it becouse not every object is fully loaded
$(".bc").fadeOut("fast");
if ( document.readyState !== 'complete' )
return;
clearInterval( tid ); // here exits from loop when page is complete
$(".bc").fadeIn(100); // and then i show on users the content
$("#cssmenu").css("display", 'block');
$("#loader").fadeOut(40); // hide loader
$("#myiframe").css("display", 'block');
$(".mastfoot").css("display", 'block');
$(".bc").css("display", 'block');
}, 500 );
</script>
我的页面看起来像这样:
<!DOCTYPE html>
<html>
<head>
<!-- head stuff -->
</head>
<body>
<div class="bc">
<!-- Content here -->
</div>
<div class="social plugins">
<!-- Content here -->
</div>
</body>
</html>
我想在加载社交插件之前显示正文内容。