[docs] provide means to have collapsible code blocks without adding a new theme

This commit is contained in:
srmo
2017-10-15 11:59:37 +02:00
parent a1e0f0ba95
commit f361092ed9
3 changed files with 47 additions and 0 deletions

10
docs/_static/custom_collapsible_code.js vendored Normal file
View File

@ -0,0 +1,10 @@
let makeCodeBlocksCollapsible = function() {
$(".toggle > *").hide();
$(".toggle .header").show();
$(".toggle .header").click(function() {
$(this).parent().children().not(".header").toggle({"duration": 400});
$(this).parent().children(".header").toggleClass("open");
});
};
// we could use the }(); way if we would have access to jQuery in HEAD, i.e. we would need to force the theme
// to load jQuery before our custom scripts