Add anchor links
This commit is contained in:
parent
c7f53f4c3a
commit
a1ed450be8
@ -1,6 +1,8 @@
|
||||
- title: Introduction
|
||||
link: index.html
|
||||
|
||||
- hr: true
|
||||
|
||||
- title: Folder Structure
|
||||
num: 1
|
||||
link: chapters/folders.html
|
||||
|
@ -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
10
static/script.js
Normal 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("#"));
|
||||
}
|
||||
});
|
||||
});
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user