• jquery Tabs选项卡切换


    效果:

    HTML部分:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>jquery Tabs选项卡切换</title>
    </head>
    <body>
    
    <div class="country-profile">
    
    <!--tabs-->
    <ul class="tabs-title clearfix">
    	<li title="tab1" class="tab-common tabActive">概况</li>
    	<li title="tab2" class="tab-common">行政</li>
    	<li title="tab3" class="tab-common">经济</li>
    	<li title="tab4" class="tab-common">教育</li>
    	<li title="tab5" class="tab-common">福利</li>
    	<li title="tab6" class="tab-common">风土人情</li>
    </ul>
    
    
    <div class="tab-contents">
    
    <span class="tab-content" id="tab1">
    	1这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    <span class="tab-content" id="tab2" style="display:none">
    	2这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    <span class="tab-content" id="tab3" style="display:none">
    	3这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    <span class="tab-content" id="tab4" style="display:none">
    	4这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    <span class="tab-content" id="tab5" style="display:none">
    	5这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    
    <span class="tab-content" id="tab6" style="display:none">
    	6这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    	这是内容这是内容这是内容这是内容
    </span>
    
    </div>
    
    <script type="text/javascript" src="js/jquery.min.js"></script>
    
    <script type="text/javascript">
    	
    $(function(){
    
    $(".tabs-title li").bind("click",function(){
    
        $(this).addClass("tabActive").siblings().removeClass("tabActive");
    
        var tagTitle=$(this).attr("title");
    
        $("#" +tagTitle).show("slow").siblings().hide("slow");
    
    });
    
    });
    
    </script>
    	
    </body>
    </html>
    

    css部分:

    *{
    		margin:0;
    		padding: 0;
    	}
    
    .clearfix:after{
    	content: ".";
    	display: block;
    	height: 0;
    	visibility: hidden;
    	clear: both;
    }
    
    .clearfix{*zoom:1;}
    
    .country-profile {
     500px;
    height: 220px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    background-color: #eee;
    }
    
    li{
        	list-style: none;
        }
    
    .tab-content {
    margin-top: -20px;
    padding: 10px;
    }
        .tabs-title {
    display: inline-block;
    }
    
    .tabs-title li{
    	float: left;
    }
    
    
    .tab-common {
    	 82px;
    	padding: 5px 0;
    	background-color: #333;
    	color: #fff;
    	margin-left: 1px;
    	text-align: center;
    	cursor: pointer;
    }
    
    .tabActive{
    	position: relative;
    	color:orange;
    }
    
    .tabActive:after{
    	content: '';
    	border-style: solid;
    	border- 0 4px 8px 4px;
    	border-color:transparent transparent #fff transparent;
    	position: absolute;
    	bottom:-2px;
    	left:50%;
    	margin-left: -4px;
    }
    
    .country-flag {
    	240px;
    	height: 203px;
            float: left;
    }
    

      

  • 相关阅读:
    Python-类和实例
    Python之操作文件和目录
    Python之split()函数
    Python之切片操作
    PyCharm导入selenium的webdirver模块出错
    Python编写“去除字符串中所有空格”
    Python编写“求一元二次方程的解”
    android开发学习 ------- 【转】Genymotion 小白安装
    android开发学习 ------- git
    android开发学习 ------- MongoDB数据库简单理解
  • 原文地址:https://www.cnblogs.com/kevinCoder/p/4457582.html
Copyright © 2020-2023  润新知