网页加载前展示5秒广告 - 网站优化技巧
<html>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<title><?php echo $j12; ?></title>
<body style="margin:0;padding:0;height:100%" scroll="no">
<div id="ad" style="display:block;width:100%;height:100%;background-color:#000;position:absolute;z-index:9999;">
<img src="ad.jpg" style="display:block;width:100%;height:100%;" />
</div>
<iframe id="infrm" name="infrm" marginwidth="0" marginheight="0" width="100%" scrolling="auto" src="<?php echo $t_url ?>" frameborder="0" height="100%" allowfullscreen="true"></iframe>
<script>
$(document).ready(function(){
setTimeout(function(){
$('#ad').fadeOut('slow');
$('#infrm').fadeIn('slow');
}, 5000); // 5秒后广告消失
function fix_height() {
$('#infrm').attr('height', (($(window).height())-5) + 'px');
}
$(window).resize(function() {
fix_height();
}).resize();
$('#infrm').contentWindow.focus();
});
var iframe = document.getElementById('infrm');
if (iframe.attachEvent){ // 兼容IE写法
iframe.attachEvent('onload', function(){
// iframe加载完成后要进行的操作
})
} else {
iframe.onload = function(){
// iframe加载完成后要进行的操作
document.title="<?php echo $title ?>";
top.document.getElementById('paneloading').style.display = 'none';
top.document.getElementById('Zl').style.display = '';
// alert('加载完成');
}
}
</script>
</html>
原文地址: http://www.cveoy.top/t/topic/mzBw 著作权归作者所有。请勿转载和采集!