如果改变上滑和下滑的速度 下面是我的代码 感觉有些慢<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$("img").animate({top:"100px"});
});
$(".btn2").click(function(){
$("img").animate({top:"0px"});
});
});
</script>
</head>
<body>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>
<div style="position:relative">
<img src="1.png" style="position:absolute"/>
</div>
</body>
</html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$("img").animate({top:"100px"});
});
$(".btn2").click(function(){
$("img").animate({top:"0px"});
});
});
</script>
</head>
<body>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>
<div style="position:relative">
<img src="1.png" style="position:absolute"/>
</div>
</body>
</html>
这个东西的第二个参数是设置速度的,查下看speed可选。规定动画的速度。默认是 "normal"。
可能的值:
毫秒 (比如 1500)
"slow"
"normal"
"fast"
$("img").animate({top:"0px"},"10000");});
$("img").animate({top:"0px"},10000);});直接就这样写就好了,只是你这个速度估计看不出来吧太慢了