国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

JQuery動畫animate的stop方法使用詳解

2019-11-20 20:42:38
字體:
來源:轉載
供稿:網友
animate語法:
復制代碼 代碼如下:

$(selector).animate(styles,speed,easing,callback)

復制代碼 代碼如下:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Testing</title>
<link rel="stylesheet" href="css/reset.css">
<script src="js/jquery.js"></script>
<style>
.wrap {
position: relative;
height: 300px;
width: 300px;
border:5px solid #FCF;
}
.wrap div {
position: absolute;
left: 0;top: 0;
height: 50px;
width: 50px;
background: #FA0;
}
</style>
</head>
<body>
<input type="button" id="btn1" value="停止當前動畫">
<input type="button" id="btn2" value="停止所有動畫">
<input type="button" id="btn3" value="停止所有動畫,到達終點">
<div class="wrap">
<div></div>
</div>
<script>
function moveX(){
$('.wrap div').animate({'left':'250px'},1000).animate({'left':'0px'},1000);
} moveX();

$('#btn1').click(function(){
$('.wrap div').stop(); // 停止當前動畫,沿路返回起點,若是返回過程中再點擊,會暫停在路中
clearInterval();
})

$('#btn2').click(function(){
$('.wrap div').stop(true); // 停止所有動畫 去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會暫停在路中
})

$('#btn3').click(function(){
$('.wrap div').stop(true,true); // 停止所有動畫 ,去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會停止到在起點
})

// .stop() // 停止當前動畫
// .stop(true) // 停止所有動畫
// .stop(true,true) // 停止所有動畫,到達動畫終點
</script>
</body>
</html>

.stop(); // 停止當前動畫,沿路返回起點,若是返回過程中再點擊,會暫停在路中

.stop(true); // 停止所有動畫 去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會暫停在路中

.stop(true,true); // 停止所有動畫 ,去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會停止到在起點
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 和顺县| 会宁县| 丽江市| 阿拉善右旗| 濉溪县| 宁阳县| 杂多县| 武鸣县| 通山县| 江阴市| 甘谷县| 五常市| 鹿泉市| 罗平县| 澎湖县| 沙田区| 望谟县| 大城县| 竹山县| 亚东县| 大港区| 崇义县| 衡阳县| 理塘县| 富宁县| 攀枝花市| 景谷| 扎囊县| 沐川县| 乌兰县| 沂南县| 扶绥县| 长阳| 商城县| 营口市| 平南县| 筠连县| 鲁山县| 新宁县| 寻乌县| 建平县|