Here, what I came up with, you can only change two selectors ( a[data-toggle="tab"] , ._tabs_navigation ) to indicate which buttons switch those tabs if you have more than one set:
$(document).ready(function() { var tabIndex; var tabs = $('a[data-toggle="tab"]'); tabs.on('shown', function(e) { tabIndex = $(e.target).closest('li').index(); }).eq(0).trigger('shown'); $('._tabs_navigation').on('click', 'a', function() { var index = tabIndex + ($(this).index() ? 1 : -1); if (index >= 0 && index < tabs.length) { tabs.eq(index).tab('show'); } return false; }); })โ
The markup for buttons is important only for the _tabs_navigation class:
<div class="btn-toolbar clearfix"> <div class="btn-group pull-left _tabs_navigation" data-toggle="buttons-radio"> <a class="btn btn-small btn-info" href="#"> <i class="icon-arrow-left icon-white"></i> </a> <a class="btn btn-small btn-info" href="#"> <i class="icon-arrow-right icon-white"></i> </a> </div> </div>
Working example: http://jsfiddle.net/gEn8f/2/
source share