allow closing tabs by clicking them again
also pass the proper type to attr() - it expects strings!
This commit is contained in:
parent
c93c93a805
commit
435c8032f2
1 changed files with 7 additions and 6 deletions
|
@ -11,28 +11,29 @@ jQuery(function () {
|
|||
$metaBox.on('click', '.meta-tabs a', function (e) {
|
||||
e.preventDefault();
|
||||
const $tab = jQuery(this);
|
||||
const isopen = $tab.attr('aria-expanded') === 'true';
|
||||
|
||||
// disable all existing tabs
|
||||
$metaBox.find('.meta-tabs li')
|
||||
.removeClass('active')
|
||||
.find('a')
|
||||
.attr('aria-expanded', false);
|
||||
.attr('aria-expanded', 'false');
|
||||
$metaBox.find('.meta-content .tab-pane')
|
||||
.removeClass('active')
|
||||
.attr('aria-hidden', false);
|
||||
.attr('aria-hidden', 'false');
|
||||
|
||||
if (isopen) return; // tab was open, we closed it. we're done
|
||||
|
||||
// enable current tab
|
||||
$tab
|
||||
.attr('aria-expanded', true)
|
||||
.attr('aria-expanded', 'true')
|
||||
.closest('li')
|
||||
.addClass('active');
|
||||
$metaBox.find($tab.attr('href'))
|
||||
.addClass('active')
|
||||
.attr('aria-hidden', false);
|
||||
.attr('aria-hidden', 'false');
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue