用JQ写的简单的收起拉开

用JQ写的简单的收起拉开

html:

<div class="box">
	<h3 class="shouqi">收起</h3>
	<h3 id="lakai" style="display: none;">拉开</h3>
</div>

css:

.box{
	width: 200px;
	height: 400px;
	background: pink;
	position: fixed;
	top: 100px;
	right: 0;
}
h3{
	position: absolute;
	top: 120px;
	left: -36px;
	cursor: pointer;
}

JS:

$('.shouqi').click(function(){
	$('.box').animate({right:'-195'},100,function(){
			$('.shouqi').hide()
			$('#lakai').show()
		})
})
$('#lakai').click(function(){
	$('.box').animate({right:'0'},100,function(){
		$('.shouqi').show()
		$('#lakai').hide()
	})
})
发布了1 篇原创文章 · 获赞 0 · 访问量 6

猜你喜欢

转载自blog.csdn.net/weixin_42480374/article/details/105723030
今日推荐