2
扩大我有一个简单的代码,扩展一个div水平和垂直地从中心, 但只扩展到向左或向底部,我希望它扩展到两个侧(左= 50像素,右边= 50像素)或(顶部= 50像素,底部= 50像素)从中心总等于100px。 这里的代码:动画一个div和从中心
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color:#bca;
background: #fff;
position: absolute;
top: 50%;
left: 50%;
background-repeat: no-repeat;
background-position: center center;
border:1px solid green;
padding:10px;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button id="go">» Run</button>
<div id="block">Hello!</div>
<script>
$("#go").click(function(){
$("#block").animate({
width: "100px",
height: "100px",
opacity: 0.6,
}, 1500);
});
</script>
</body>
谢谢。
哇,太酷了,这是我想要的!谢谢你救了我的一天〜如果按节拍按钮旁边的向上和向下箭头,那么你可以记住我的答案为“接受”,每个人都会知道你的问题已经解决,什么解决办法是 – vikenoshi
@vike。 – theguywholikeslinux