Add automatic anchor symbols using anchorjs

This commit is contained in:
Philipp Oppermann
2016-01-17 15:21:04 +01:00
parent 82e230c257
commit 1d7b913a1a
5 changed files with 15 additions and 0 deletions

6
_includes/anchorjs.html Normal file
View File

@@ -0,0 +1,6 @@
<script type="text/javascript">
anchors.options = {
placement: 'left',
};
anchors.add('article h2, article h3, article h4, article h5, article h6');
</script>

View File

@@ -22,4 +22,7 @@
<!-- RSS -->
<link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="{{ site.baseurl }}/atom.xml">
<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
</head>

View File

@@ -8,4 +8,5 @@ layout: default
<hr>
{% include disqus.html %}
{% include anchorjs.html %}
</article>

View File

@@ -19,4 +19,5 @@ layout: default
<hr>
{% include disqus.html %}
{% include anchorjs.html %}
</article>

View File

@@ -47,6 +47,10 @@ a {
}
}
a.anchorjs-link:hover {
text-decoration: none;
}
img {
display: block;
max-width: 100%;