Skip to content

Commit bbee704

Browse files
authored
Merge pull request docker#10287 from thaJeztah/add_back_anchorlinks
Re-enable "anchorlink" script
2 parents b633d3c + 5276ea1 commit bbee704

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

_layouts/docs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ <h2>Next steps</h2>
295295
hljs.initHighlightingOnLoad();
296296
</script>
297297
{% endif %}
298-
<!-- <script src="/js/anchorlinks.js"></script> -->
298+
<script defer src="/js/anchorlinks.js"></script>
299299
<script defer src="/js/menu.js"></script>
300300
<script src="/js/jquery.js"></script>
301301
<script src="/js/bootstrap.min.js"></script>

_scss/_content.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,18 @@ pre code {
116116
}
117117

118118
a.anchorLink {
119+
font-size: 0.5em;
119120
margin-left: 5px;
120121
visibility: hidden;
121122
}
122123

124+
h1:hover > a.anchorLink,
125+
h2:hover > a.anchorLink,
126+
h3:hover > a.anchorLink
127+
{
128+
visibility: visible;
129+
}
130+
123131
a.glossary {
124132
color: $body-text-color;
125133
text-decoration: none;

js/anchorlinks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
(function(d) {
22
"use strict";
3-
var hs = d.getElementById("DocumentationText").querySelectorAll("H1, H2, H3"), h;
3+
var hs = d.querySelectorAll("H1, H2, H3"), h;
44

55
for (var i = 0; i < hs.length; i++) {
66
h = hs[i];
77
if (h.id != null && h.id.length > 0) {
8-
h.insertAdjacentHTML('beforeend', '<a href="' + window.location.href + '#' + h.id + '" class="anchorLink"></a>')
8+
h.insertAdjacentHTML('beforeend', '<a href="' + window.location.href + '#' + h.id + '" class="anchorLink">🔗</a>')
99
}
1010
}
1111

0 commit comments

Comments
 (0)