pelican-jdr/public/plugins/tabs.js
2023-02-03 20:32:38 +01:00

28 lines
969 B
JavaScript

function customTabs(hook, vm) {
hook.doneEach(function() {
// Invoked each time after the data is fully loaded, no arguments,
$(".contentArea :first-child").addClass("active")
$(".tab :first-child").addClass("active")
$(".tablinks").click(function(){
var idParent = "#" + $(this).parent().parent().attr("id")
var targetString = idParent + " .contentArea ." + $(this).attr("data-target")
//On fait en sorte que seule la classe visée soit active
$(idParent + " .contentArea .tabcontent").removeClass("active")
$(targetString).addClass("active")
// On fait de meme pour le bouton
$(idParent + " .tab button").removeClass("active")
$(this).addClass("active")
console.log(idParent + " .contentArea .tabcontent")
console.log(idParent + " .tab button")
console.log(targetString)
});
});
}
window.$docsify.plugins = [].concat(
customTabs,
(window.$docsify.plugins || [])
);