Add AnchorJS logic for header links (#10155)

* Add AnchorJS JavaScript

* Remove existing inpage_heading logic

* Remove underline from anchor tags

* Use single icon and add touch visibility

* Use paragraph link icon for AnchorJS

* Update Sass to use code formatting in docsContent headers

* Update header size coverage to H3-H6
This commit is contained in:
Luc Perkins
2018-09-10 13:09:36 -07:00
committed by k8s-ci-robot
parent c038d8909c
commit 9ce0cd0906
12 changed files with 23 additions and 1978 deletions
+1 -18
View File
@@ -48,22 +48,5 @@
</div>
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
<script>
// This script turns in-page headers into clickable and shareable
(function addHeadingLinks(){
var article = document.getElementById('docsContent');
var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6');
headings.forEach(function(heading){
if(heading.id){
var a = document.createElement('a');
a.innerHTML = heading.innerHTML;
a.href = '#'+heading.id;
a.classList.add('inpage_heading');
heading.innerHTML = '';
heading.appendChild(a);
}
});
})();
</script>
</body>
</html>
</html>