mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 04:08:27 +08:00
parent
28e052dbce
commit
d7fd8af1d5
|
@ -14,5 +14,38 @@
|
|||
</div>
|
||||
</div>
|
||||
{% include footer.html %}
|
||||
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Create intra-page links
|
||||
Requires that your headings already have an `id` attribute set (because that's what jekyll does)
|
||||
For every heading in your page, this adds a little anchor link `#` that you can click to get a permalink to the heading.
|
||||
Ignores `h1`, because you should only have one per page.
|
||||
The text content of the tag is used to generate the link, so it will fail "gracefully-ish" if you have duplicate heading text.
|
||||
*/
|
||||
|
||||
var headingNodes = [], results, link,
|
||||
tags = ['h2', 'h3', 'h4'];
|
||||
|
||||
tags.forEach(function(tag){
|
||||
results = document.getElementsByTagName(tag);
|
||||
Array.prototype.push.apply(headingNodes, results);
|
||||
});
|
||||
|
||||
headingNodes.forEach(function(node){
|
||||
link = document.createElement('a');
|
||||
link.className = 'anchor-link';
|
||||
link.textContent = '#';
|
||||
link.href = '#' + node.getAttribute('id');
|
||||
if (node.getAttribute('id')) {
|
||||
node.appendChild(link);
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -116,3 +116,8 @@ footer.nav-footer {
|
|||
.nav-refs a {
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.anchor-link {
|
||||
margin-left: 5px;
|
||||
font-size: 80%;
|
||||
}
|
Loading…
Reference in New Issue
Block a user