欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JQuery動(dòng)畫(huà)animate的stop方法使用詳解

 更新時(shí)間:2014年05月09日 09:03:51   作者:  
這篇文章主要介紹了JQuery動(dòng)畫(huà)animate的stop方法使用,需要的朋友可以參考下
animate語(yǔ)法:
復(fù)制代碼 代碼如下:

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

復(fù)制代碼 代碼如下:

<!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="停止當(dāng)前動(dòng)畫(huà)">
<input type="button" id="btn2" value="停止所有動(dòng)畫(huà)">
<input type="button" id="btn3" value="停止所有動(dòng)畫(huà),到達(dá)終點(diǎn)">
<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(); // 停止當(dāng)前動(dòng)畫(huà),沿路返回起點(diǎn),若是返回過(guò)程中再點(diǎn)擊,會(huì)暫停在路中
clearInterval();
})

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

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

// .stop() // 停止當(dāng)前動(dòng)畫(huà)
// .stop(true) // 停止所有動(dòng)畫(huà)
// .stop(true,true) // 停止所有動(dòng)畫(huà),到達(dá)動(dòng)畫(huà)終點(diǎn)
</script>
</body>
</html>

.stop(); // 停止當(dāng)前動(dòng)畫(huà),沿路返回起點(diǎn),若是返回過(guò)程中再點(diǎn)擊,會(huì)暫停在路中

.stop(true); // 停止所有動(dòng)畫(huà) 去的路程中點(diǎn)擊停止會(huì)直接到達(dá)終點(diǎn),若是返回過(guò)程中再點(diǎn)擊,會(huì)暫停在路中

.stop(true,true); // 停止所有動(dòng)畫(huà) ,去的路程中點(diǎn)擊停止會(huì)直接到達(dá)終點(diǎn),若是返回過(guò)程中再點(diǎn)擊,會(huì)停止到在起點(diǎn)

相關(guān)文章

最新評(píng)論