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

首頁 > 語言 > JavaScript > 正文

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

2024-05-06 16:05:36
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了JQuery動畫animate的stop方法使用,需要的朋友可以參考下

animate語法:

復制代碼 代碼如下:


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


復制代碼 代碼如下:


<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Testing</title>
<link 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" value="停止當前動畫">
<input type="button" value="停止所有動畫">
<input type="button" value="停止所有動畫,到達終點">
<div>
<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); // 停止所有動畫 ,去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會停止到在起點
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 洪洞县| 广丰县| 余干县| 瑞金市| 射洪县| 遵义市| 南川市| 夏河县| 方城县| 徐汇区| 深圳市| 民勤县| 河南省| 舞钢市| 东阿县| 乌什县| 霍山县| 林西县| 大石桥市| 海盐县| 博野县| 新竹市| 贵定县| 南雄市| 鞍山市| 咸丰县| 姚安县| 阜城县| 辽阳市| 舞阳县| 青州市| 江阴市| 天门市| 临高县| 明溪县| 香河县| 浦县| 子洲县| 泗阳县| 桃江县| 图木舒克市|