metabox part 3
This commit is contained in:
parent
d62df8bdbf
commit
92c91ef8b0
5 changed files with 67 additions and 17 deletions
41
js/meta-box.js
Normal file
41
js/meta-box.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
(function ($, spc) {
|
||||
|
||||
var toggleTabs = function () {
|
||||
|
||||
var $metaBox = $('#meta-box'),
|
||||
$tabLinks = $metaBox.find('.meta-tabs').find('a'),
|
||||
$tabPanels = $metaBox.find('.meta-content').find('.tab-pane');
|
||||
|
||||
try {
|
||||
$tabLinks.each(function () {
|
||||
$(this).on("click", function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this),
|
||||
$panel = $($link.attr('href'));
|
||||
|
||||
//reset
|
||||
resetTabs();
|
||||
|
||||
//current state
|
||||
$link.addClass('active').attr('aria-expanded','true');
|
||||
$panel.addClass('active').attr('aria-hidden','false');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
} catch (err) {
|
||||
alert('err');
|
||||
}
|
||||
},
|
||||
resetTabs = function($tabLinks,$tabPanels){
|
||||
$tabLinks.closest('li').removeClass('active');
|
||||
$tabLinks.attr('aria-expanded','false');
|
||||
$tabPanels.removeClass('active').attr('aria-hidden','true');
|
||||
};
|
||||
|
||||
$(function () {
|
||||
toggleTabs();
|
||||
});
|
||||
|
||||
})(jQuery, spc);
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
|
||||
|
||||
}catch(err){
|
||||
alert('err');
|
||||
//console.log('err');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue