Hello to all, welcome to therichpost.com. In this post, I will tell you, Jquery Custom tabs Effect. I personally like jquery very much. Most of my code is full with jquery. When I stuck in php or other language then that stuckness I remove with jquery code.
I am making Jquery Custom tabs Effect because this reusable in every where no need to any thing else. just code this and use this any where.
Here are the Commenting Style In Javascript:
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script>
<script type=”text/javascript”>
jQuery(document).ready(function($) {
/*Tabs*/
$(“.nav-tabs li:first-child”).addClass(‘active’);
$(“.tab-pane”).hide();
$(“.tab-pane:first-child”).addClass(‘active’).show();
$(“.nav-tabs li a”).each(function(){
$(this).on(“click”, function(e){
e.preventDefault();
$(“.nav-tabs li”).removeClass(“active”);
$(this).closest(“li”).addClass(“active”);
var hrefval = $(this).attr(“href”);
$(“.tab-pane”).hide();
$(hrefval).show();
});});
/*Tabs*/
});
</script>
<style type=”text/css”>
.nav-tabs {
border-bottom: 1px solid #ddd;}
.nav-tabs li:hover, .nav-tabs li.active {
border-bottom: 3px solid #17a2b8;
}
a {
transition: all 0.2s ease-in-out;
}
.nav-tabs li {
padding: 6px 12px;
border-bottom: 3px solid transparent;
margin-bottom: -2px;
float: left;
list-style-type: none;
}.nav {
display: flex;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.tab-content{border: 1px solid #17a2b8;
height: 200px;
padding: 10px;}
</style>
<ul class=”nav nav-tabs”>
<li class=””><a href=”#tab1″>tab1</a></li>
<li class=””><a href=”#tab2″>tab2</a></li>
<li class=””><a href=”#tab3″>tab3</a></li>
<li class=””><a href=”#tab4″>tab4</a></li>
</ul>
<div class=”tab-content”>
<div class=”tab-pane” id=”tab1″>
tab1
</div>
<div class=”tab-pane” id=”tab2″>
tab2
</div>
<div class=”tab-pane” id=”tab3″>
tab3
</div>
<div class=”tab-pane” id=”tab4″>
tab4
</div>
</div>
There are so many jquery code, tricks and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com
Recent Comments