(-1)写在前面

首先图片是我从互联网上下载的,向这位前辈致敬。我用的是chrome49,没有加不同浏览器的前缀,jquery3.0,图片资源放在了我的百度云盘上http://pan.baidu.com/s/1o7LyHp4

(1)知识预备

a.浏览器x、y、z轴的概念

左手竖代表y轴,右手横代表x轴,左右手摆成一个十字,z轴是即垂直x轴也垂直y轴穿过x、y交点的一条直线。

b. :nth-of-type(1)

img:nth-of-type(1),所有有子元素img的父元素的第一个img子元素

body :nth-of-type(1) 等同于body *:nth-of-type(1)

(2)代码

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset=utf-8>

<script   type="text/javascript" src="debug-jquery-3.0.0.js"></script>

<script   type="text/javascript" src="base.js"></script>

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<title>为了生活</title>

<style type="text/css">

*

{

margin-top:0px;

padding:0;

}

body

{

position:absolute;

}

#lol

{

width:530px;

height:530px;

position:absolute;

}

#lol img

{

display:block;

position:absolute;

border:1px #6F0000 solid;

}

#lol img:nth-of-type(1)

{

animation: one 10s linear 3s infinite;

}

@keyframes one

{

to

{

transform: rotateX(360deg);

}

}

#lol img:nth-of-type(2)

{

animation: two 10s linear 2s infinite;

}

@keyframes two

{

to

{

transform: rotateY(360deg);

}

}

#lol img:nth-of-type(3)

{

animation: three 10s linear 1s infinite;

}

@keyframes three

{

to

{

transform:rotateZ(360deg);

}

}

</style>

<script type="text/javascript">

$(function()

{

$("#lol").centerPos();

//让lol元素水平垂直居中显示,centerPos是自定义函数

})

$.fn.centerPos = function()

{

var parent;

this.each(function(index)

{

parent = this.parentNode;

if(parent == document.body)

{

parent = window;

}

var position = $(this).css("position");

if(position == "fixed" || position=="absolute")

{

$(this).css("left",($(parent).width()-this.offsetWidth)/2+"px")

.css("top",($(parent).height()-this.offsetHeight)/2+"px");

}

else

{

window.console.error("没有设置有效的position值");

}

})

return this;

}

</script>

</head

<body>

<div id="lol">

<img src="data:images/main5-pic1.png">

<img src="data:images/main5-pic2.png">

<img src="data:images/main5-pic3.png">

</div>

</body>

</html>

最新文章

  1. jquery 杂记
  2. jQuery动画的实现
  3. maven安装和配置
  4. clip-path
  5. Myeclipse的web工程和Eclipse互相转换
  6. eclipse的使用-------Text File Encoding没有GBK选项的设置
  7. Android intent传递list或对象
  8. CCS 5 XDS100 仿真连接错误Error connecting to the target【瓦特芯笔记】
  9. MVC生命周期
  10. 01-UIKit
  11. ADT后windows菜单未找到Android SDK Manager和Android Virtual Device Manager该解决方案的选择
  12. bug记录_signalr执行$.connnection.testhub结果为空
  13. logback中配置的日志文件的生成地址
  14. 滚动视差?CSS 不在话下
  15. 访问arcserver中的featureServer服务
  16. 浅谈spring为什么推荐使用构造器注入
  17. 洛谷AT2046 Namori(思维,基环树,树形DP)
  18. lojround3
  19. NetScaler 10.1的配置以及结合StoreFront的部署
  20. java的子类覆盖梗

热门文章

  1. BZOJ4415: [Shoi2013]发牌
  2. uC/OS-II测试(TEST)块
  3. phpspidercookie
  4. PHP页面跳转
  5. XtraFinder在OSX10.11的使用
  6. Quartz.NET总结(三)Quartz 配置
  7. Lua弱引用table
  8. CDN技术
  9. js字符串转成数字的三种方法
  10. 原生JavaScript技巧大收集(11~20)-(终于又被我找到这篇文章了)