64 lines
1.6 KiB
HTML
64 lines
1.6 KiB
HTML
<!-- Sourcecode at https://stackoverflow.com/questions/34481638/how-to-use-tocify-with-asciidoctor-for-a-dynamic-toc -->
|
|
|
|
<script src="./jquery-1.11.3.min.js"></script>
|
|
<script src="./jquery-ui.min.js"></script>
|
|
<script src="./jquery.tocify.min.js"></script>
|
|
|
|
<style>
|
|
.tocify-header {
|
|
font-style: italic;
|
|
}
|
|
|
|
.tocify-subheader {
|
|
font-style: normal;
|
|
font-size: 100%;
|
|
}
|
|
|
|
.tocify ul {
|
|
margin: 0;
|
|
}
|
|
|
|
.tocify-focus {
|
|
color: #7a2518;
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.tocify-focus > a {
|
|
color: #7a2518;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
$("#toc").append("<div id='generated-toc'></div>");
|
|
$("#generated-toc").tocify({
|
|
extendPage: true,
|
|
context: "#content",
|
|
highlightOnScroll: true,
|
|
hideEffect: "slideUp",
|
|
hashGenerator: function(text, element) {
|
|
return $(element).attr("id");
|
|
},
|
|
smoothScroll: false,
|
|
theme: "none",
|
|
selectors: $( "#content" ).has( "h1" ).size() > 0 ? "h1,h2,h3,h4,h5" : "h2,h3,h4,h5",
|
|
ignoreSelector: ".discrete"
|
|
});
|
|
|
|
var handleTocOnResize = function() {
|
|
if ($(document).width() < 768) {
|
|
$("#generated-toc").hide();
|
|
$(".sectlevel0").show();
|
|
$(".sectlevel1").show();
|
|
}
|
|
else {
|
|
$("#generated-toc").show();
|
|
$(".sectlevel0").hide();
|
|
$(".sectlevel1").hide();
|
|
}
|
|
}
|
|
|
|
$(window).resize(handleTocOnResize);
|
|
handleTocOnResize();
|
|
});
|
|
</script> |