標籤:style blog http io ar color os sp java
通過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(‘‘, "_blank", ‘‘); 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>
css3動畫棧效果_1