jquery slideToggle 上下滑动的时候 如果一下子点击多次 会在那不停的 上下 滑动
jqueryslideToggle上下滑动的时候如果一下子点击多次会在那不停的上下滑动。怎么能让其在不点的那一刻不再继续滑动...
jquery slideToggle 上下滑动的时候 如果一下子点击多次 会在那不停的 上下 滑动 。怎么能让其在不点的那一刻 不再继续滑动
展开
展开全部
用判断语句is(":animated"),我给你两段代码你自己试试
这一段是有问题的:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){ //********问题点在这里,这里没有判断是否处于动画
$(".panel").slideToggle("slow");
});
});
</script>
<style type="text/css">
div.panel, p.flip
{
width:200px;
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
width:200px;
height:150px;
display:none;
}
</style>
</head>
<body>
<p class="flip">显示/隐藏</p>
<div class="panel">
<p>Because time is valuable, we deliver quick and easy learning.</p>
<p>You can study everything you need to learn, in an accessible and handy format.</p>
</div>
</body>
</html>
这一段是没问题的:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
if(!$(".panel").is(":animated")){ //********问题点在这里,这里有判断是否处于动画
$(".panel").slideToggle("slow");
}
});
});
</script>
<style type="text/css">
div.panel, p.flip
{
width:200px;
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
width:200px;
height:150px;
display:none;
}
</style>
</head>
<body>
<p class="flip">显示/隐藏</p>
<div class="panel">
<p>Because time is valuable, we deliver quick and easy learning.</p>
<p>You can study everything you need to learn, in an accessible and handy format.</p>
</div>
</body>
</html>
希望能够帮助到你
这一段是有问题的:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){ //********问题点在这里,这里没有判断是否处于动画
$(".panel").slideToggle("slow");
});
});
</script>
<style type="text/css">
div.panel, p.flip
{
width:200px;
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
width:200px;
height:150px;
display:none;
}
</style>
</head>
<body>
<p class="flip">显示/隐藏</p>
<div class="panel">
<p>Because time is valuable, we deliver quick and easy learning.</p>
<p>You can study everything you need to learn, in an accessible and handy format.</p>
</div>
</body>
</html>
这一段是没问题的:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
if(!$(".panel").is(":animated")){ //********问题点在这里,这里有判断是否处于动画
$(".panel").slideToggle("slow");
}
});
});
</script>
<style type="text/css">
div.panel, p.flip
{
width:200px;
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
}
div.panel
{
width:200px;
height:150px;
display:none;
}
</style>
</head>
<body>
<p class="flip">显示/隐藏</p>
<div class="panel">
<p>Because time is valuable, we deliver quick and easy learning.</p>
<p>You can study everything you need to learn, in an accessible and handy format.</p>
</div>
</body>
</html>
希望能够帮助到你
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询