返回古诗词停止或快......登陆

古诗词停止或快速完成

皮皮爱吃瓜子2018-11-28 23:19:07247
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Jquery</title>
	<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
	<style type="text/css">
		*{padding: 0px;margin: 0px;}
		div{width: 300px;height: 200px;background: #ccc;text-align: center;line-height: 50px;}
		.dj{width: 300px;height: 30px;background: #e6db74;border: none;padding-top: 0px;color: white;font-weight: bold;display: block;}
		.an{width: 147px;height: 30px;border: solid 2px black;margin: 30px 0px;}
	</style>
	<script type="text/javascript">
		$(function(){
			$("div").hide();
			$(".dj").click(function(){
				$("div").slideToggle(2000);
			})
			$("#tz").click(function(){
				$("div").stop();
			})
			$("#wc").click(function(){
				$("div").stop(true,true);
			})
		})
	</script>
</head>
<body>
	<button class="an" id="tz">停止动画</button>
	<button class="an" id="wc">完成动画</button>
	<button class="dj">点击</button>
	<div>
		<h2>春晓</h2>
		<p>春眠不觉晓,处处闻啼鸟。<br />
		夜来风雨声,花落知多少。</p>
	</div>
</body>
</html>

1,隐藏div

$("div").hide();

2,点击class属性值为dj的元素,向下2000的速度滑动显示,或者向上隐藏

$(".dj").click(function(){
	$("div").slideToggle(2000);
})

3,点击id为tz的按钮,停止当前div的活动

$("#tz").click(function(){
    $("div").stop();
})

4,点击id为wc的按钮,快速完成当前div的活动

$("#wc").click(function(){
    $("div").stop(true,true);
})


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送