mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-19 10:44:38 -04:00
Fix js for toc
This commit is contained in:
parent
7768124fb2
commit
ed50c7dbd0
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: The Benefits of Static
|
||||
linktitle: Benefits of Static
|
||||
linktitle: The Benefits of Static
|
||||
description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
|
@ -5,10 +5,9 @@ description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [wercker]
|
||||
weight:
|
||||
draft: false
|
||||
type:
|
||||
layout:
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
|
@ -1,10 +1,12 @@
|
||||
//removes toc if not enough headings
|
||||
(function() {
|
||||
let tocLinks = document.querySelectorAll('#TableOfContents > ul a');
|
||||
if(tocLinks && tocLinks.length < 2){
|
||||
document.getElementById('toc').remove();
|
||||
}else if (tocLinks && tocLinks.length > 1){
|
||||
document.getElementById('toc-toggle').addEventListener('click',toggleToc,false);
|
||||
let toc = document.getElementById('toc');
|
||||
console.log(tocLinks);
|
||||
if (toc && (tocLinks.length < 2)) {
|
||||
toc.remove();
|
||||
} else if (tocLinks.length > 1) {
|
||||
document.getElementById('toc-toggle').addEventListener('click', toggleToc, false);
|
||||
}
|
||||
})();
|
||||
|
||||
|
2
themes/hugodocs/static/js/script.min.js
vendored
2
themes/hugodocs/static/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user