div的移动特效
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<style type="text/css">
#d1
{
width:100px;
height:100px;
position:absolute;
background-color:Red;
left:10px;
top:50px;
<!--filter:alpha(opacity=0);-->
}
</style>
<script type="text/javascript">
$(function () {
$("#btn").click(function () {
//animate里面的参数是按照先静后动来执行的,所以有一个参数是函数参数,先执行前面的后执行动画里面的
$("#d1").animate({ "left": 300, "top": 300, "opacity": 100 }, 1000).animate({ "width": 300, "height": 300, "opacity": 10 }, 1000, function () {
$(this).css("background-color", "blue");
});
})
//左移
$("#btn1").click(function () {
$("#d1").animate({ "left": "-=80" },1000);
})
//右移
$("#btn2").click(function () {
$("#d1").animate({ "left": "+=80" }, 1000);
})
})
</script>
</head>
<body>
<input id="btn" type="button" value="动画" />
<input id="btn1" type="button" value="向左"/>
<input id="btn2" type="button" value="向右"/>
<div id="d1">
</div>
<audio src="铃声 - 听海.mp3" autoplay="autoplay"></audio><br />
<video src="说好的及格呢.mp4" width="100px" height="100px" controls="controls" autoplay="autoplay"></video>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<style type="text/css">
#d1
{
width:100px;
height:100px;
position:absolute;
background-color:Red;
left:10px;
top:50px;
<!--filter:alpha(opacity=0);-->
}
</style>
<script type="text/javascript">
$(function () {
$("#btn").click(function () {
//animate里面的参数是按照先静后动来执行的,所以有一个参数是函数参数,先执行前面的后执行动画里面的
$("#d1").animate({ "left": 300, "top": 300, "opacity": 100 }, 1000).animate({ "width": 300, "height": 300, "opacity": 10 }, 1000, function () {
$(this).css("background-color", "blue");
});
})
//左移
$("#btn1").click(function () {
$("#d1").animate({ "left": "-=80" },1000);
})
//右移
$("#btn2").click(function () {
$("#d1").animate({ "left": "+=80" }, 1000);
})
})
</script>
</head>
<body>
<input id="btn" type="button" value="动画" />
<input id="btn1" type="button" value="向左"/>
<input id="btn2" type="button" value="向右"/>
<div id="d1">
</div>
<audio src="铃声 - 听海.mp3" autoplay="autoplay"></audio><br />
<video src="说好的及格呢.mp4" width="100px" height="100px" controls="controls" autoplay="autoplay"></video>
</body>
</html>
感谢来访,共同学习!