Its been easy now to have cookie based tabs using jQuery!
Follow the instructions and you are done 🙂
HTML
<div id="profileTabList">
<a href="#ambedkar">Dr. Ambedkar</a>
<a href="#buddha">Buddha</a>
<a href="#navayan">Navayan</a>
</div>
<div id="profileTabData">
<div id="ambedkar">
<h2>" Men are mortal. So are ideas. An idea needs propagation as much as a plant needs watering. Otherwise both will wither and die. "</h2>
</div>
<div id="buddha">
<h2>" Better than a thousand hollow words, is one word that brings peace. "</h2>
</div>
<div id="navayan">
<h2>" In today's date every movement must stay online. Else it is like a bird with brocken arms! "</h2>
<h2>- <a href="http://www.navayan.com/" target="_blank">Navayan.com - Homeland of Ambedkarite Buddhist!</a></h2>
</div>
</div>
CSS
.tabs a{
-moz-border-radius: 14px;
-webkit-border-radius: 14px;
border-radius: 14px;
padding:6px 12px;
font-weight: 700;
text-decoration: none;
color: #06e;
}
.tabs .active{
color:#fff;
background: #06a;
}
#profileTabList{
min-width: 270px;
padding: 12px 30px;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ccc;
background:#efefef;
background-image: -o-linear-gradient(top,#fff,#efefef);
background: -moz-linear-gradient(center top , #fff, #efefef) repeat scroll 0 0 transparent;
background: -webkit-gradient(linear, center top, center bottom, from(#fff), to(#efefef));
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ffffff',EndColorStr='#efefef');
}
.tab_content{
display:none;
clear:both;
padding: 22px 30px;
}
Javascript
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://www.navayan.com/js/jquery.cookie.js"></script>
<script src="http://cookie-based-jquery-tabs.googlecode.com/files/cookie-based-jquery-tabs.js"></script>
That’s all !
May 9, 2013 at 8:01 pm
this code is not working and i constate that there is missing data in the code HTML
May 10, 2013 at 8:47 am
Re-checked. It worked. What was your testing environment?
May 16, 2013 at 8:09 pm
The html is incorrect……but the demo is correct.
In the above HTML you are missing class=”tabs”
and in each of the div’s with the content you are missing class=”tab_content”
I have the updated html code below to make it all work correctly.
Dr. Ambedkar
Buddha
Navayan
” Men are mortal. So are ideas. An idea needs propagation as much as a plant needs watering. Otherwise both will wither and die. ”
” Better than a thousand hollow words, is one word that brings peace. ”
” In today’s date every movement must stay online. Else it is like a bird with brocken arms! ”
March 30, 2015 at 1:20 pm
I have tried to use this code but its now working perfectly.
the live demo is working good but i downloaded all those files and did correctly but still not working, can you please provide a download link of code with working example
thanks