JSFiddle - React, Tailwind, and code Playground
HTML
<div class="selpak-wrapper">
<h1 class="title">Pricing and Packages</h1>
<div id="v-nav">
<ul>
<li tab="tab1" class="first current">Design</li>
<li tab="tab2">Specs</li>
<li tab="tab3">Price</li>
<li tab="tab4" class="last">Release Date</li>
</ul>
<div style="display: block;" class="tab-content">
<h4>Tab 1</h4>
</div>
<div style="display: none;" class="tab-content">
<h4>Tab 2</h4>
</div>
<div style="display: none;" class="tab-content">
<h4>Tab 3</h4>
</div>
<div style="display: none;" class="tab-content">
<h4>Tab 4</h4>
</div>
</div>
</div>
CSS
.selpak-wrapper
{
width: 960px;
margin: 0px auto;
padding-top: 20px;
min-height: 600px;
}
.selpak-wrapper h1, .selpak-wrapper h4, .selpak-wrapper p, .selpak-wrapper pre, .selpak-wrapper ul, .selpak-wrapper li
{
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
background: transparent;
}
.selpak-wrapper li
{
outline: 0;
text-decoration: none;
-webkit-transition-property: background color;
-moz-transition-property: background color;
-o-transition-property: background color;
-ms-transition-property: background color;
transition-property: background color;
-webkit-transition-duration: 0.12s;
-moz-transition-duration: 0.12s;
-o-transition-duration: 0.12s;
-ms-transition-duration: 0.12s;
transition-duration: 0.12s;
-webkit-transition-timing-function: ease-out;
-moz-transition-timing-function: ease-out;
-o-transition-timing-function: ease-out;
-ms-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
#v-nav
{
height: 100%;
margin: auto;
color: #333;
font: 12px/18px "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
}
#v-nav >ul
{
float: left;
width: 210px;
display: block;
position: relative;
top: 0;
border: 1px solid #DDD;
border-right-width: 0;
margin: auto 0 !important;
padding:0;
}
#v-nav >ul >li
{
width: 180px;
list-style-type: none;
display: block;
text-shadow: 0px 1px 1px #F2F1F0;
font-size: 1.11em;
position: relative;
border-right-width: 0;
border-bottom: 1px solid #DDD;
margin: auto;
padding: 10px 15px !important;
background: whiteSmoke; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f2f2f2 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f2f2f2)); /* Chrome,Safari4+ */
background:...
JavaScript
$(function () {
var block = false;
var tabWait = -1;
$('#v-nav>ul>li').mouseout(function(){
block = true;
setTimeout(function(){ block = false; },400);
});
var items = $('#v-nav>ul>li').each(function () {
$(this).mouseover(function () {
var me = this;
if(block){
clearTimeout(tabWait);
tabWait = setTimeout(function(){
$(me).mouseover();
},400);
return;
}
//remove previous class and add it to clicked tab
items.removeClass('current');
$(this).addClass('current');
$('#v-nav>div.tab-content').hide().eq(items.index($(this))).show();
window.location.hash = $(this).attr('tab');
});
});
if (location.hash) {
showTab(location.hash);
}
else {
showTab("tab1");
}
function showTab(tab) {
$("#v-nav ul li:[tab*=" + tab + "]").mouseover();
}
// Bind the event hashchange, using jquery-hashchange-plugin
/*$(window).hashchange(function () {
showTab(location.hash.replace("#", ""));
})*/
// Trigger the event hashchange on page load, using jquery-hashchange-plugin
/*$(window).hashchange();*/
});