Created
September 28, 2016 15:19
-
-
Save oKcerG/83340484000ef970bf8fd9d7dea0f1de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sections = document.querySelectorAll(".sg-section"); | |
var ul = document.createElement('ul'); | |
sections[0].parentNode.insertBefore(ul, sections[0]); | |
for (var i=0; i < sections.length; ++i) { var elem = sections[i].children[0]; var li = document.createElement('li'); li.innerHTML='<a href="#'+elem.id+'">'+elem.textContent+'</a>'; ul.appendChild(li); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment