Home  >  Article  >  Web Front-end  >  超简单TAB切换_html/css_WEB-ITnose

超简单TAB切换_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:57:351371browse

<div class="tab-fbox2"> <ul class="title-list2 clearfix"> <li class="active2">第一个</li> <li>第二个</li> <li>第三个</li> <li>第三个</li> </ul> <div class="tcont-box2"> <div class="tcont2" style="display:block;">第一个的内容</div> <div class="tcont2">第二个的内容</div> <div class="tcont2">第三个的内容</div> <div class="tcont2">第三个的内容</div> </div> </div>

<script type="text/javascript" src="js/jquery-1.8.3.js"></script><script type="text/javascript">$(function(){ $('.tab-fbox2').on('mouseover', '.title-list2 li', function(e){ var index = $(this).index(); $(this).addClass('active2').siblings().removeClass('active2'); $(e.delegateTarget).find('.tcont2').eq(index).show().siblings().hide(); }); }); </script>

style样式

.tab-fbox2{ width:500px; margin:20px 0 0 50px;}.tab-fbox2 .title-list2 li{ float:left; width:100px; height:20px; text-align:center; line-height:20px; background-color:#000; color:#fff; border-right:solid 2px #fff; cursor:pointer;}.tab-fbox2 .title-list2 li.active2{ background-color:#f00;}.tab-fbox2 .tcont-box2{ border:solid 1px #000; height:300px;}.tab-fbox2 .tcont-box2 .tcont2{ display:none;}

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn