js 弹簧效果代码(2)


<style type="text/css">
.container{border:1px solid #000000;height:50px; width:500px;}
.bounce{width:10px; height:10px; background:#000000;top:20px;}
</style>
固定范围反弹:
<div>
<div> </div>
</div>
<br />
范围渐变反弹:
<div>
<div> </div>
</div>
<br />
自定范围反弹:
<div>
<div> </div>
</div>
<br />
范围:
<input type="text" value="200" size="8" />
<input type="button" value=" 开始 " />
<input type="button" value=" 加速 + " />
<input type="button" value=" 减速 - " />
<input type="button" value=" 渐 小 " />


测试代码:

复制代码 代码如下:


new Bounce("idContainer", "idBounce", 250, 200);
var o = new Bounce("idContainer1", "idBounce1", 250, 200, {
Zoom: 20, Max: 200,
onMax: function(){ o.Reduce = true; o.Start(200); },
onMin: function(){ o.Reduce = false; o.Start(0); }
});

var o2 = new Bounce("idContainer2", "idBounce2", 250);
$("bb").onclick = function(){ o2.Start(parseInt($("aa").value) || 200); }
$("idFast").onclick = function(){ if(--o2.Step<2){o2.Step=2} }
$("idSlow").onclick = function(){ if(++o2.Step>20){o2.Step=20} }
$("idZoom").onclick = function(){ o2.Zoom=50; }



[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzfwj.html