javascript - tabs navigation using html5 or jquery -
below code:
<div id="container"> <!-- start tabs !--> <div class="tab-container"> <div id="c1"> <a href="#c1" title="projects">companies</a> <!-- actual tab , content below !--> <div class="tab-content"> <!-- tab-container > div > div in css !--> <header id="companies"> <h3> 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> i have given css3 styling these tabs . want make these rows tabs mena vertical tabs when click it, should display data. can me please , want using html5, css3 or jquery only.
below existing css.
<style> p, .tab-content li, h1, h2, h3{ /* insures there's enough space between 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 position entire tab module */ width:1000px; margin-top:20px; } .tab-container > div { display:inline; } .tab-container > div > { position:relative; /* keeps tabs in line 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{ /* container holds 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 content front depending on tab clicked */ } /****** imports other stylesheets don't have call them in 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>
if want show data these tabs use:
$(document).ready(function() { $("#tabid").click(function() { $("#tabdata").show(); )} )} this way can show data each tab. on click.
note click isn't function, can set hover object too. change data if there hover on tab.
can hide 1 div, , show other! thats how can done jquery. else if want load data after page loads. use jquery ajax as:
$.ajax({ // here should ajax properties, such page name data load , on success, on fail, on error. })
Comments
Post a Comment