jquery动画之tab切换

demo代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
		}
		div {
			width: 400px;
			height: 326px;
			margin: 100px auto;
		}
		ul {
			list-style: none;
		}
		.top {
			width: 400px;
			height: 26px;
		}
		.top li {
			box-sizing: border-box;
			width: 81px;
			line-height: 24px;
			float: left;
			text-align: center;
			background: yellow;
			border: 1px solid #000;
			margin-left: -1px;
			cursor: pointer;
		}
		.bottom {
			width: 400px;
			height: 300px;
			position: relative;
		}
		.bottom li {
			width: 401px;
			height: 300px;
			background: red;
			position: absolute;
			top: 0;
			left: 0;
			border: 1px solid #000;
			border-top: 0;
			box-sizing: border-box;
			font-size: 30px;
			text-align: center;
			line-height: 300px;
			margin-left: -1px;
			display: none;
		}
		.bottom .one {
			display: block;
		}
	</style>
</head>
<body>
	<div>
		<ul class="top">
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
		</ul>
		<ul class="bottom">
			<li class="one">A</li>
			<li>B</li>
			<li>C</li>
			<li>D</li>
			<li>E</li>
		</ul>
	</div>
	<script type="text/javascript">
		$(".top li").click(function(){
			$(this).css("border-botttom",0);
			$(".bottom li").eq($(this).index()).css("display","block");
			$(".bottom li").eq($(this).index()).siblings().css("display","none");
		})
	</script>
</body>
</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值