Widget:Toc
Материал из Ролевой сервер "tales.pw"
Версия от 19:54, 30 ноября 2019; Xunto (обсуждение | вклад)
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css">
<script>
var element = document.createElement("div"); element.id="tocbot" element.style["position"] = "fixed"; element.style["top"] = "55px"; element.style["left"] = "0px"; element.style["width"] = "200px"; element.style["height"] = "100%";
document.body.appendChild(element);
var headingSelector = "h1, h2, h3";
$(headingSelector).each(function() { var current_id = $(this).attr('id'); console.log(current_id)
}
);
tocbot.init({
tocSelector: '#tocbot', contentSelector: '#content', headingSelector: headingSelector, hasInnerContainers: true,
}); </script>