Add anchor links

gh-pages
rubenwardy 2015-01-01 17:05:03 +00:00
parent c7f53f4c3a
commit a1ed450be8
4 changed files with 26 additions and 0 deletions

View File

@ -1,6 +1,8 @@
- title: Introduction
link: index.html
- hr: true
- title: Folder Structure
num: 1
link: chapters/folders.html

View File

@ -1,3 +1,5 @@
</div>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="{{ page.root }}static/script.js"></script>
</body>
</html>

10
static/script.js Normal file
View File

@ -0,0 +1,10 @@
$(function() {
return $("h2, h3, h4, h5, h6").each(function(i, el) {
var $el, icon, id;
$el = $(el);
id = $el.attr('id');
if (id) {
return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html("#"));
}
});
});

View File

@ -116,6 +116,18 @@ code {
white-space: pre;
}
.header-link {
position: absolute;
right: 10px;
text-decoration: none;
color: #bbb;
}
.header-link:hover {
color: #999;
}
h1 {
text-align: center;
margin: 10px 0 0 0;