Skip to content

Commit 5a23683

Browse files
author
Bryan Berg
committed
anchor links!
1 parent df83435 commit 5a23683

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

content/assets/js/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,11 @@ $(function() {
6262
el.html(el.html().replace(needle, token.user_token));
6363
});
6464
});
65+
66+
$(".content h1, .content h2, .content h3, .content h4").each(function(e){
67+
var id = $(this).attr("id");
68+
if (!id) return;
69+
70+
$(this).append("<a class='header-anchor' href='#" + id + "'></a>");
71+
});
6572
});

static/css/style.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ ul.nav-list {
202202
padding: 0 0 20px 0;
203203
-webkit-font-smoothing: subpixel-antialiased;
204204
border: none;
205+
width: auto;
205206
}
206207

207208
ul.nav-list li {
@@ -368,3 +369,27 @@ html.breakpoint-retina .promo-block-image.authentication {
368369
margin-left:auto;
369370
*zoom:1
370371
}
372+
373+
.header-anchor {
374+
top: 0;
375+
opacity: 0;
376+
padding: 0 5px 0 10px;
377+
height: 100%;
378+
width: 20px;
379+
font-size: 12px;
380+
font-weight: normal;
381+
-webkit-font-smoothing: antialiased;
382+
383+
-webkit-transition: opacity 0.3s ease-in-out 0s;
384+
-moz-transition: opacity 0.3s ease-in-out 0s;
385+
-ms-transition: opacity 0.3s ease-in-out 0s;
386+
}
387+
388+
.content h1:hover .header-anchor, .content h2:hover .header-anchor, .content h3:hover .header-anchor, .content h4:hover .header-anchor, .header-anchor:hover {
389+
opacity: 1;
390+
text-decoration: none;
391+
}
392+
393+
.header-anchor:before {
394+
content:'#';
395+
}

0 commit comments

Comments
 (0)