繁体   English   中英

使用html5或jquery进行标签导航

[英]tabs navigation using html5 or jquery

下面是我的代码:

<div id="container">
    <!-- Start Tabs !-->
    <div class="tab-container">    
        <div id="c1">
            <a href="#c1" title="Projects">Companies</a> <!-- This is your actual tab and the content is below it !-->
            <div class="tab-content">  <!-- tab-container > div > div in the CSS !-->
                <header id="companies">
                    <h3>&nbsp;&nbsp;Companies(5)</h3>    
                </header>  
                <button id="create" onclick="addRow()">Create</button>

                <button id="edit">Edit</button> 
                <div id="table">
                    <table id="col">
                        <tr ><th>Company1</th></tr>
                        <tr><th>Comapny2</th></tr>
                        <tr><th>Company3</th></tr>
                        <tr><th>Company4</th></tr>
                        <tr><th>Company5</th></tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>      

我给这些选项卡设置了CSS3样式。 现在,我想将这些行也设置为选项卡,并指向垂直选项卡,这样当我单击它时,它应该显示一些数据。 谁能帮我,我想只使用html5,css3或jquery。

以下是我现有的CSS。

 <style>
    p, .tab-content li, h1, h2, h3{ /* This insures that there's enough space between your paragraphs, headings, etc */
        margin-bottom: 10px;
    }
    a{
        text-decoration:none;
        color:black;
    }

    .tab-container {
        position: relative;
        width: 100%;
        z-index:0;
        color:black;
        font-size:20px;
         border-style:solid;
        border-color:#FFFFFF;

    }
    #container{ /* Use this to position the entire tab module */

        width:1000px;
         margin-top:20px;




    }

     .tab-container > div {
        display:inline;
    } 

    .tab-container > div > a {
        position:relative;
     /* Keeps the tabs in line with each other */
        text-decoration: none;
        color: black;
         display: inline-block; 
        padding: 4px 14px;
        font-size:15px;
        font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
        font-weight:normal;
        margin-top:2px;
         background: #E5E4E2;  /* old browsers */ 
        width:70px;
        height:40px;
        border-style:solid;
        border-color:#D1D0CE;
    }

    .tab-container > div > a:hover {
        /* background: none repeat scroll 0 0 #948a81; */
        background: #B6B6B4;
    }

    .tab-container > div > div{ /* This is the container which holds the tab content */

         background-color:#FFFFFF;
         z-index:0;
        top: 75px;
       padding:0px 5px 15px 20px;
        min-height:500px;
        position:absolute; /* Fixes IE 7 & 8 */
        outline-offset: -8px;

    }

    .tab-container > div:target > div {
        position: absolute;
         z-index: 3 !important;  /* Brings the content to the front depending on the tab that was clicked */
    }




    /******  This imports other stylesheets so you don't have to call them in an html file *****/
    @import url('../../reset.css');
     div.tab-content{     
          width:1000px;
        margin-top:20px;
        display:table;
    }

    button{


        padding: 4px 14px;

         background: #E5E4E2;  /* old browsers */ 
        width: 80px;
        height: 30px;
        border-style:solid;
        border-color:#D1D0CE;
        margin-top:20px;
    }





     button:hover{
    background: #B6B6B4;

    }
    #table tr>th{

      float:left;
      background-color:#EFECE5;
      layout-grid:vertical-ideographic;
      padding:50;
      margin-left:0px;
       height:50px;
       margin-top:20px;
       width:300px;
       border-color:#E5E4E2;
       text-align:left;
       border-width:2px;
       border-style: solid;
    }

    #table tr>th:hover{

     background: #B6B6B4;

     }
    </style>

如果要显示这些选项卡中的某些数据,请使用:

$(document).ready(function() {
 $("#tabid").click(function() {
  $("#tabdata").show();
 )}
)}

这样,您可以显示每个选项卡中的数据。 点击。
注意单击不是唯一的功能,您也可以设置悬停对象。 如果选项卡上悬停了更改数据。
您可以隐藏一个div,然后显示另一个! 多数民众赞成在jQuery中完成。 否则,如果您想在页面加载后加载数据。 使用jQuery AJax作为:

$.ajax({
 // here should be the ajax properties, such as page name data to load and   
 on success, on fail, on error.
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM