css3动画栈效果_1

下图通过css3动画栈实现了鼠标移上图片,图片发亮的效果。

具体代码如下:

<!DOCTYPE html>
<html id="ok">
<head>
<style> 
div
{
width:100px;
height:100px;
background:blue;

}
div:hover,img:hover{animation:shade 5s;
-webkit-animation:shade 5s;
-moz-animation:shade 5s;
-o-animation:shade 5s;
animation:shade 5s;
}
@keyframes shade{
from{opacity:1;}
15%{opacity:0.4;}
to{opacity:1;}
}
@-webkit-keyframes shade{
from{opacity:1;}
15%{opacity:0.4;}
to{opacity:1;}
}
@-moz-keyframes shade{
from{opacity:1;}
15%{opacity:0.4;}
to{opacity:1;}
}
@-o-keyframes shade{
from{opacity:1;}
15%{opacity:0.4;}
to{opacity:1;}
}
</style>
</head>
<body>

<div></div>

<p><img src="http://pica.nipic.com/2007-12-24/20071224112445514_2.jpg"/></p>
<a id="run" href="javascript:void(0);">运行代码</a>
</body>
</html>
<script src="http://pc1.gtimg.com/js/jquery-1.4.4.min.js"></scirpt>
<script type="text/javascript">
function runCode(obj) {
  var winname = window.open('', &quot;_blank&quot;, '');
  winname.document.open('text/html', 'replace');
  winname.opener = null // 防止代码对论谈页面修改
  winname.document.write(obj.value);
  winname.document.close();

$(document).ready(function(){
$("#run").click(function(){
runCode($("#ok"));

})
})
</script>

 

转载于:https://www.cnblogs.com/jiaojiaome/p/4126554.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值