国产探花免费观看_亚洲丰满少妇自慰呻吟_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); // 停止所有動畫 ,去的路程中點擊停止會直接到達終點,若是返回過程中再點擊,會停止到在起點
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 怀远县| 彰武县| 河北省| 伊金霍洛旗| 行唐县| 邵东县| 塔河县| 屯门区| 高尔夫| 沅江市| 乌兰察布市| 黄浦区| 阳城县| 理塘县| 申扎县| 阜康市| 延庆县| 乾安县| 焉耆| 喀喇沁旗| 麻栗坡县| 潜江市| 峨边| 淅川县| 河曲县| 仁寿县| 皋兰县| 伊春市| 沙田区| 钦州市| 咸阳市| 扶余县| 开原市| 娱乐| 砚山县| 凤山县| 清徐县| 札达县| 烟台市| 平安县| 驻马店市|