点击链接后,页面上的一个方块区域可以非常艺术性的跑动,非常有趣
第一步:
点击这里下载源代码
第二步:
在网页<head>区添加以下代码
<script type="text/javascript" src="http://www.sharejs.com/code/ajax/jquery/10/jquery.js"></script>
<script type="text/javascript">
/*****************************************************
* Share JavaScript (http://www.ShareJS.com)
* 使用此脚本程序,请保留此声明
* 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
******************************************************/
$(document).ready(function(){
$(".run").click(function(){
$("#box").animate({opacity: "0.1", left: "+=400"}, 1200)
.animate({opacity: "0.4", top: "+=160", height: "20", width: "20"}, "slow")
.animate({opacity: "1", left: "0", height: "100", width: "100"}, "slow")
.animate({top: "0"}, "fast")
.slideUp()
.slideDown("slow")
return false;
});
});
</script>
<style type="text/css">
body {
margin: 20px auto;
padding: 0;
width: 580px;
font: 80%/120% Arial, Helvetica, sans-serif;
}
a {
font-weight: bold;
color: #000000;
}
#box {
background: #6699FF;
height: 100px;
width: 100px;
position: relative;
}
</style>
第三步:
在网页<body>区添加以下代码
<p><a href="#" class="run">运行试试</a></p> <div id="box"> </div>




