(24)-- 制作复杂选项卡

#引入JavaScript制作复杂选项卡


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>选项卡</title>
	<style>
	body,ul,li{
		padding: 0;
		margin: 0;
		list-style: none;
	}
	.wrap{
		width: 500px;
		height: 500px;
		border:1px solid red;
		
		margin:0 auto;
		margin-top: 50px;
		

	}
	.title li{
		width: 126px;
		height: 50px;
		border: 1px solid pink;
		float: left;
		box-sizing: border-box;
		margin-left: -1px;
		border-top: none;
		
		line-height: 50px;
		text-align: center;
		cursor: pointer;
	}
	.title li:first-child{
		border-left: none;
	}
	.title li:last-child{
		border-right: none;
	}
	 .title .active1{
		border-bottom: none;
	}
	.content li{
		height: 450px;
		display: none;
		line-height: 450px;
		text-align: center;
		
		
	}
	.content .active2{
		display: block;
	}
</style>

</head>
<body>
	<div class="wrap">
		<ul class="title" >
			<li class='active1'>标题一</li>
			<li>标题二</li>
			<li>标题三</li>
			<li>标题四</li>

		</ul>
		<ul class='content' >
			<li class='active2'>内容一</li>
			<li>内容二</li>
			<li>内容三</li>
			<li>内容四</li>
		</ul>
	</div>
	<script src="./jquery-1.8.3.min.js"></script>
	<script>
		$('.title li').click(function(){
			$(this).attr('class','active1').siblings().removeAttr('class');
			var ind=$(this).index();
			$('.content li').eq(ind).attr('class','active2').siblings().removeAttr('class');
		})
	</script>
</body>
</html>



兄弟连学python


Python学习交流、资源共享群:563626388 QQ


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值