Created
September 14, 2017 14:36
-
-
Save bepatrickdavid/54b47243b5ea5882ce4b67e24eb61455 to your computer and use it in GitHub Desktop.
JS: Simple Tab - tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$('.ttabs').on("click", " .ttab", function () { | |
$(this).siblings().removeClass('active'); | |
$(this).addClass('active'); | |
var tabID = $(this).attr('data-ttab'); | |
var tabSelected = $(this).closest('.ttabs-wrap').find("[data-ttab='" + tabID + "']"); | |
tabSelected.siblings().removeClass('active'); | |
tabSelected.addClass('active'); | |
}); | |
</script> | |
<section class="ttabs-wrap"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-12"> | |
<div class="ttabs"> | |
<div class="ttab active" data-ttab="one">Title tab one</span></div> | |
<div class="ttab" data-ttab="two">Title tab two</div> | |
<div class="ttab" data-ttab="three">Title tab three</div> | |
</div> | |
<ul class="active" data-ttab="one"> | |
<li> | |
</li> | |
</ul> | |
<ul data-ttab="two"> | |
<li> | |
</li> | |
</ul> | |
<ul data-ttab="three"> | |
<li> | |
</li> | |
</ul> | |
</div> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment