<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<SCRIPT type="text/javascript" src="jquery-1.8.3.min.js"></SCRIPT>-->
<SCRIPT type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></SCRIPT>
<style type="text/css">
#content {
border:0px solid #ff9999;
width:0px;
height:0px;
padding:3px;
}
</style>
</head>
<body>
<input id="btn" type="button" value="Animate"/>
<div id="content"></div>
</body>
<script>
$(document).ready(function(){
$('#btn').click(function(){
$('#content')
.animate({
"borderLeftWidth":"1px",
"height":"400px"
},1000)
.animate({
"borderBottomWidth":"1px",
"width":"400px"
},1000)
.animate({"borderRightWidth":"1px"
},1000)
.animate({"borderTopWidth":"1px"
},1000)
});
});
</script>
</html>
我想通过使用jQuery的动画功能做一些有用的事情。所以如果你运行我的代码,你可以看到border-left和border-bottom是连续生成的,因为我的宽度和高度都在增加。但在此之后,边界右边和边界刚刚弹出。我希望他们被动画为左边界和下边界。我会怎么做?使用带边框属性的jQuery动画
所以这是不可能的呢?有没有办法做到这一点? – ntstha 2013-02-17 14:50:25
它不是关于动画的边界的宽度。我想要边界做一个正方形。从一个点开始,然后增加,直到它成为一个正方形。 – ntstha 2013-02-17 14:52:26
如果你正在考虑像边界这样的东西开始在某个时刻变得可见,那么就像一条越来越长的蛇一样在元素周围移动,这是不可能的。好吧,任何事情都是可能的,但这并不容易! – adeneo 2013-02-17 14:55:16