【发布时间】:2015-03-08 03:44:47
【问题描述】:
我试图用 jQuery、CSS 和 HTML 制作 2 个动画框,但代码不起作用。我在一个 jQuery 教程应用程序中制作了该应用程序,它在该应用程序上运行良好。当我在我的电脑上使用确切的代码时,它不起作用。我的代码有什么问题?
这是我的代码:
<!doctype html>
<html>
<head>
<title>Testing Stuff</title>
</head>
<body>
<div class="blueBox"></div>
<div class="redBox"></div>
<style>
.blueBox, .redBox {
width: 100px;
height: 100px;
top: 20px;
position: absolute;
}
.redBox {
left: 20px;
background-color: red;
}
.blueBox {
left: 140px;
background-color: blue;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
var $blueBox = $('div.blueBox');
var $redBox = $('div.redBox');
$blueBox.animate({left: "500px"}, 2000, function(){alert("Animation Completed!");
});
$redBox.animate({width: "0px", height: "0px", opacity: "0"}, 3000);
});
</script>
</body>
</html>
谢谢你帮助我!!
【问题讨论】:
标签: jquery html css animation jquery-animate