HTML5树叶飘落动画
2015年03月26日 11:04
0 点赞
0 评论
更新于 2017-05-09 02:42
HTML源代码
以下是实现HTML5树叶飘落动画的HTML代码:
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5树叶飘落动画 - 柯乐义</title>
<base target="_blank" href="http://keleyi.com/keleyi/phtml/css3/" />
<meta charset="utf-8">
<meta name="viewport" content="width=500px, initial-scale=0.64">
<link rel="apple-touch-icon" href="http://keleyi.com/keleyi/phtml/css3/15/images/apple-touch-icon.png" />
<!-- The leaves.css file animates the leaves -->
<link rel="stylesheet" href="http://keleyi.com/keleyi/phtml/css3/15/leaves.css" type="text/css" media="screen" charset="utf-8">
<script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.11.2.min.js"></script>
<!-- The leaves.js file creates the leaves -->
<script src="http://keleyi.com/keleyi/phtml/css3/15/leaves.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div style="text-align: center; clear: both; margin-top:0px">
<span id="keleyi">
<a href="http://keleyi.com">首页</a>
<a href="http://keleyi.com/keleyi/phtml/">特效库</a>
<a href="http://keleyi.com/a/bjae/h1o76nuh.htm">原文</a>
请使用Chrome浏览器查看本页。
</span>
</div>
<div id="container">
<!-- The container is dynamically populated using the init function in leaves.js -->
<!-- Its dimensions and position are defined using its id selector in leaves.css -->
<div id="leafContainer"></div>
<!-- its appearance, dimensions, and position are defined using its id selector in leaves.css -->
<div id="message">
<em>落红不是无情物</em>
</div>
</div>
</body>
</html>
代码说明
<head>
部分:- 设置了页面的标题为“HTML5树叶飘落动画 - 柯乐义”。
- 通过
<base>
标签设置了页面内所有相对链接的基础URL。 - 声明了字符编码为UTF - 8,并设置了视口相关参数。
- 引入了苹果触摸图标,用于在iOS设备上显示。
- 引入了
leaves.css
文件,该文件用于实现树叶的动画效果。 - 引入了jQuery库和
leaves.js
文件,leaves.js
文件负责创建树叶元素。 <body>
部分:- 页面顶部有一个包含首页、特效库和原文链接的导航区域,并提示使用Chrome浏览器查看本页。
<div id="container">
是主要的容器,其中<div id="leafContainer">
会通过leaves.js
中的init
函数动态填充内容,其尺寸和位置在leaves.css
中定义;<div id="message">
显示一段文字“落红不是无情物”,其外观、尺寸和位置同样在leaves.css
中定义。
注意事项
建议使用Chrome浏览器查看该页面,以确保动画效果的正常显示。相关资源文件(如leaves.css
和leaves.js
)可通过提供的链接获取。