zoukankan      html  css  js  c++  java
  • tab点击切换

    <!DOCTYPE html>
    <html>
    
    	<head>
    		<meta charset="UTF-8">
    		<title></title>
    		<style>
    			* {
    				box-sizing: border-box;
    			}
    			
    			#nav {
    				height: 50px;
    			}
    			
    			#nav a {
    				display: block;
    				height: 50px;
    				line-height: 50px;
    				padding: 0 15px;
    				font-size: 18px;
    				text-align: center;
    				font-family: 'Microsoft YaHei';
    				float: left;
    				background- color: #e1e1e1;
    				cursor: pointer;
    			}
    			
    			#nav a.on {
    				border-bottom: 2px solid #e60012;
    			}
    			
    			#contentBox {
    				 280px;
    				height: 100px;
    			}
    			
    			#contentBox .box {
    				text-align: center;
    				line-height: 100px;
    				font-size: 24px;
    				font-weight: blod;
    				display: none;
    			}
    			
    			#contentBox .box.active {
    				display: block;
    			}
    		</style>
    		<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
    	</head>
    
    	<body>
    		<section>
    			<nav id="nav">
    				<a class="on">tab1</a>
    				<a>tab2</a>
    				<a>tab3</a>
    				<a>tab4</a>
    			</nav>
    			<div id="contentBox">
    				<div class="box active">内容一</div>
    				<div class="box">内容二</div>
    				<div class="box">内容三</div>
    				<div class="box">内容四</div>
    			</div>
    		</section>
    
    	</body>
    	<script type="text/javascript">
    		$(function() {
    			$("#nav a").off("click").on("click", function() {
    				var index = $(this).index();
    				$(this).addClass("on").siblings().removeClass("on");
    				$("#contentBox .box").eq(index).addClass("active").siblings().removeClass("active");
    			});
    		});
    	</script>
    
    </html>
    
  • 相关阅读:
    C++ 概念易错点
    C++的位操作符备忘
    C++关键词
    在ubuntu下安装drupal6
    C++符号优先级一览
    开启drupal的clear urls
    VC6.0使用PlaySound函数报错
    小记一下以非string为结束条件的循环
    C++中查看数据类型的方法
    在ubuntu下安装和配置drupal
  • 原文地址:https://www.cnblogs.com/gxywb/p/10006260.html
Copyright © 2011-2022 走看看