请教一下大神!
为啥我把span的position的值改为relative以后图像从左往右移动的时候就变为一根线在移动了是怎么回事呢求大神解释一下感谢
<!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>调用stop()方法停止当前所有动画效果</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3>调用stop()方法停止当前所有动画效果</h3>
<span></span>
<input id="btnStop" type="button" value="停止" />
<div id="tip"></div>
<script type="text/javascript">
$(function () {
$("span").animate({
left: "+=100px"
}, 3000, function () {
$(this).animate({
height: '+=60px',
width: '+=60px'
}, 3000, function () {
$("#tip").html("执行完成!");
});
});
$("#btnStop").bind("click", function () {
$("span").stop()
$("#tip").html("执行停止!");
});
});
</script>
</body>
</html>其中还有段css代码
div
{
margin: 10px 0px;
}
span
{
position:relative;
width:80px;
height:80px;
border: solid 1px #ccc;
margin: 0px 1px;
background-color: Red;
color:White;
vertical-align:middle
}