我做了一个div宽度100%和高度宽度* .1在jquery中。准确的数字。高度
我设法扩大高度,尽管比例但我无法设法扩大它准确。
我其实想把它扩大到400px,可能吗?
这里是我的代码:http://jsfiddle.net/2drYk/3/
*
{
margin:0;
padding:0;
border:0
}
.container
{
width:100%;
background:black;
}
<figure class="container">
</figure>
$('.container').height($(this).width()*0.1);
var toggleCheck =0;
$('.container').click(function(){
if(toggleCheck ==1){
$(this).stop().animate({height: ($(this).height()-$(this).width()*0.1)});
toggleCheck = 0;
}else{
$(this).stop().animate({height: ($(this).width()*0.1 + $(this).height())});
toggleCheck = 1;
}
});
我不明白:如果要扩大到400像素,为什么烦心事服用计算?可能我不明白你的问题? – Sunyatasattva
是[this](http://jsfiddle.net/2drYk/6/)你想要什么? – pktangyue