码迷,mamicode.com
首页 > Web开发 > 详细

jQuery+CSS3实现404背景动画特效

时间:2016-06-04 13:27:34      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

效果:
http://hovertree.com/texiao/jquery/74/

源码下载:
http://hovertree.com/h/bjaf/ko0gcgw5.htm

效果图如下:
技术分享

代码如下:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery+CSS3实现404背景动画特效 - 何问起</title><base target="_blank" />
<link href="http://hovertree.com/texiao/jquery/74/css/404.css" rel="stylesheet" type="text/css" />
<script src="http://down.hovertree.com/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function() {
var h = $(window).height();
$(body).height(h);
$(.mianBox).height(h);
centerWindow(".tipInfo");
});

//2.将盒子方法放入这个方,方便法统一调用
function centerWindow(a) {
center(a);
//自适应窗口
$(window).bind(scroll resize,
function() {
center(a);
});
}

//1.居中方法,传入需要剧中的标签
function center(a) {
var wWidth = $(window).width();
var wHeight = $(window).height();
var boxWidth = $(a).width();
var boxHeight = $(a).height();
var scrollTop = $(window).scrollTop();
var scrollLeft = $(window).scrollLeft();
var top = scrollTop + (wHeight - boxHeight) / 2;
var left = scrollLeft + (wWidth - boxWidth) / 2;
$(a).css({
"top": top,
"left": left
});
}
</script>
</head>
<body>
<div class="mianBox">
<img src="http://hovertree.com/texiao/jquery/74/images/yun0.png" alt="" class="yun yun0" />
<img src="http://hovertree.com/texiao/jquery/74/images/yun1.png" alt="" class="yun yun1" />
<img src="http://hovertree.com/texiao/jquery/74/images/yun2.png" alt="" class="yun yun2" />
<img src="http://hovertree.com/texiao/jquery/74/images/bird.png" alt="鸟" class="bird" />
<img src="http://hovertree.com/texiao/jquery/74/images/san.png" alt="何问起" class="san" />
<div class="tipInfo">
<div class="in">
<div class="textThis">
<h2>页面不存在</h2>
<p><span>页面将自动<a id="href" href="http://hovertree.com/h/bjaf/tiaosan.htm">跳转</a></span><span>等待<b id="wait">60</b></span></p>
<script type="text/javascript"> (function() {
var wait = document.getElementById(wait), href = document.getElementById(href).href;
var interval = setInterval(function() {
var time = --wait.innerHTML;
if (time <= 0) {
location.href = href;
clearInterval(interval);
}
;
}, 1000);
})();
</script>
</div>
</div>
</div>
</div>

<div style="text-align:center;margin:50px 0; font:normal 14px/24px ‘MicroSoft YaHei‘;">
<p>适用浏览器:360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下浏览器。</p>
<p>来源:<a href="http://hovertree.com/" target="_blank">何问起</a> <a href="http://hovertree.com/texiao/">特效</a> <a href="http://hovertree.com/h/bjaf/tiaosan.htm">原文</a></p>
</div>
</body>
</html>

转自:http://hovertree.com/h/bjaf/tiaosan.htm

特效汇总:http://www.cnblogs.com/roucheng/p/texiao.html

jQuery+CSS3实现404背景动画特效

标签:

原文地址:http://www.cnblogs.com/roucheng/p/jquerycss404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!