怎么样可以 停止以后再播放
2 回答
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>调用stop()方法停止当前所有动画效果</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
</head>
<body>
<h3>调用stop()方法停止当前所有动画效果</h3>
<span></span>
<input id="btnStop" type="button" value="停止" />
<div id="tip"></div>
<script type="text/javascript">
$(function () {
$("#btnStop").bind("click", function () {
if( $("span").is(":animated") ){
$("span").stop();
$("#tip").html("执行停止!");
}else{
$("span").animate({
left: "100px"
}, 3000, function () {
$(this).animate({
height: '+=60px',
width: '+=60px'
}, 3000, function () {
$("#tip").html("执行完成!");
});
});
}
});
});
</script>
</body>
</html>不知道是不是你想要的结果,运行试一下。
举报
0/150
提交
取消