Skip to content

Instantly share code, notes, and snippets.

@oKcerG
Created September 28, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oKcerG/83340484000ef970bf8fd9d7dea0f1de to your computer and use it in GitHub Desktop.
Save oKcerG/83340484000ef970bf8fd9d7dea0f1de to your computer and use it in GitHub Desktop.
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