// all tabe panes visible (in)
// we only toggle their contents
// trigger via nav-tabs or tab panel-title
// 3 things to update
// 1) nav-tabs li > .active
// 2) tab-pane panel-heading > .active
// 2) tab-pane panel-body > collapse (.in)
$('.panel-group').on('click', '.nav-tabs li', function (e) {
var $navItem = $(this);
var $tabPane = $($(this).find('a').data('target'));
var $panelGrp = $(this).closest('.panel-group');
updatePanelGroup($navItem, $tabPane, $panelGrp);
});
$('.panel-group').on('click', '.tab-content .panel-title', function (e) {
var $panelGrp = $(this).closest('.panel-group');
var $tabPane = $(this).closest('.tab-pane');
var href = $tabPane.attr('id');
var $navItem = $tabPane.closest('.panel-group').find('.nav-tabs a[data-target="#' + href + '"]').closest('li')
updatePanelGroup($navItem, $tabPane, $panelGrp);
});
$('.panel-group .panel-group-toggle').on('click', function (e) {
var $toggler = $(this);
var $tabPanes = $toggler.closest('.panel-group').find('.tab-pane');
var $navItems = $toggler.closest('.panel-group').find('.nav-tabs li');
if ($toggler.hasClass('all-visible')) {
// if everything is visible, then collapse everything
$navItems.removeClass('active');
$tabPanes.find('.panel-title').removeClass('active');
$tabPanes.find('.panel-body').collapse('hide');
} else {
// otherwise we'll show everything
$navItems.addClass('active');
$tabPanes.find('.panel-title').addClass('active');
$tabPanes.find('.panel-body').collapse('show');
}
$toggler.toggleClass('all-visible');
return false;
}).click();
// tab back into prev pane
var firstPanelInputs = $(".panel").map(function(){
var firstInput = $(this).find(":input:first")
return firstInput.length > 0 ? firstInput[0] : null
}).get();
$(firstPanelInputs).keydown(function (e) {
// did we hit tab
if (e.which === 9 && event.shiftKey) {
// leaving last item in panel, make sure next one is open
var $panelGrp =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.