jquery,怎么让一个div从中心慢慢变大,不要css3,是中心向4周的~

如题所述

<div id="test" style="width:50px;height:50px;position:absolute;left:200px;top:200px;background-color:#f00;">look me</div>

<script type="text/javascript"> 
window.onload = function ()
{
var test = document.getElementById("test"),
i=0,
speed = 1,
style=test.style;
function func()
{
i++;
if( i < 20 )
{
var left = style.left.substr(0,style.left.indexOf("px")),
top = style.top.substr(0,style.top.indexOf("px")),
width = style.width.substr(0,style.width.indexOf("px")),
height = style.height.substr(0,style.height.indexOf("px"));
style.left = +left - speed + "px";
style.top = +top - speed + "px";
style.width = +width + 2*speed + "px";
style.height = +height + 2*speed + "px";
}
else
 clearInterval(Timer);
}

var Timer = setInterval(func,100)
}
</script>

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-09-23
http://plugins.jquery.com/yan.ui/ 你说的刚好使这个,这个有很多功能,xia'zai'xia'lai有demo
第2个回答  2013-09-23

jq让div中心向4周变大

本回答被提问者采纳
相似回答