美文网首页
jQuery 中stop()详解

jQuery 中stop()详解

作者: 风与莹的小窝 | 来源:发表于2019-07-05 15:45 被阅读0次

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style type="text/css">

* {

margin: 0;

padding: 0;

}

div {

width: 100px;

height: 100px;

background-color: red;

}

</style>

</head>

<body>

<button>动画跑起来</button>

<button>stop(true,true)</button>

<button>stop(true,false)</button>

<button>stop(false,true)</button>

<button>stop(false,false)</button>

<div></div>

<script src="js/jquery-2.2.4.min.js"></script>

<script type="text/javascript">

//$("button").css("color","red").css("font-size","24px")

$("button:eq(0)").click(function(){

$("div").animate({

"width": 800

},3000).animate({

"height": 500

},3000)

})

$("button:eq(1)").click(function(){

//清空队列,完成当前动画

$("div").stop(true,true);

})

$("button:eq(2)").click(function(){

//清空队列,不完成当前动画

$("div").stop(true,false);

})

$("button:eq(3)").click(function(){

//不清空队列,完成当前动画

$("div").stop(false,true);

})

$("button:eq(4)").click(function(){

//不清空队列,不完成当前动画

$("div").stop(false,false);//默认

})

</script>

</body>

</html>

相关文章

网友评论

      本文标题:jQuery 中stop()详解

      本文链接:https://www.haomeiwen.com/subject/bvsehctx.html