知识库

js制作竖向的tab选项卡特效例子

来源: 本站    类别: 知识库    日期: 2016/7/1

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ru">
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

<style type="text/css">

*{
margin:0;padding:0;
 -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
         box-sizing: border-box;

 

}
.container{
margin:0 auto;
width:500px;
overflow:hidden;

background:beige;
}


li{

border-top:1px solid lightgrey;
border-left:1px solid lightgrey;
border-right:1px solid lightgrey;
height:35px;
line-height:35px;
list-style:none;
text-align:center;
width:100px;

}
li:last-child{
height:159px;border-right:1px solid lightgrey;border-bottom:1px solid lightgrey;
}
li.active {

border-right:1px solid white;background:white;

}
li.normal {

border-right:1px solid white;background:red;

}
#tab_content{

float:right;
width:400px;
*width:394px;
background:white;
height:300px;
overflow:hidden;
border-top:1px solid lightgrey;
border-right:1px solid lightgrey;
border-bottom:1px solid lightgrey;
border-left:0px solid lightgrey;
}
#tab_content .content{

  padding: 15px;
    -moz-border-radius: 5px;
height:300px;
   

}
</style>

</head>
<body>


<div class='container' >

 <div id="tab_content">
 
 <div id="a" class="content">

aaaaa
  </div>
   <div id="b" class="content">

bbbbb
  </div>
 <div id="c" class="content">

cccccc
  </div>
 <div id="d" class="content">

Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
Gumby
A responsive 960 grid from Digital Surgeons
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20140315 Firefox/24.0 PaleMoon/24.4
DDDDDDDDDDDDDDd
  </div>
</div>
<div >
<ul id='tabnav'><li ><a href="#a" >A</a></li>
<li class='active'><a href="#b" >B</a></li>
<li><a href="#c" >C</a></li>
<li><a href="#d" >D</a></li>
<li ><a href="#d" ></a></li>
</ul>

</div>

</div> 
<script type="text/javascript">
function changeStyle(){
 this.onclick=function(){
   var list=this.parentNode.childNodes;
   for(var i=0;i<list.length;i++){
        if(1==list[i].nodeType &&  'active'==list[i].className) {
                list[i].className="";
        }
   }
 this.className='active';
 }


}

 var tabs=document.getElementById('tabnav').childNodes;
 for(var i=0;i<tabs.length;i++){
    if(1==tabs[i].nodeType){
       changeStyle.call(tabs[i]);
    }
}

 

</script>
</body>
</html>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com