Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

anchor links!

  • Loading branch information...
commit 5a236839cd33cb1b7bb1384b2153e6cbd51326b5 1 parent df83435
@berg berg authored
Showing with 32 additions and 0 deletions.
  1. +7 −0 content/assets/js/app.js
  2. +25 −0 static/css/style.css
View
7 content/assets/js/app.js
@@ -62,4 +62,11 @@ $(function() {
el.html(el.html().replace(needle, token.user_token));
});
});
+
+ $(".content h1, .content h2, .content h3, .content h4").each(function(e){
+ var id = $(this).attr("id");
+ if (!id) return;
+
+ $(this).append("<a class='header-anchor' href='#" + id + "'></a>");
+ });
});
View
25 static/css/style.css
@@ -202,6 +202,7 @@ ul.nav-list {
padding: 0 0 20px 0;
-webkit-font-smoothing: subpixel-antialiased;
border: none;
+ width: auto;
}
ul.nav-list li {
@@ -368,3 +369,27 @@ html.breakpoint-retina .promo-block-image.authentication {
margin-left:auto;
*zoom:1
}
+
+.header-anchor {
+ top: 0;
+ opacity: 0;
+ padding: 0 5px 0 10px;
+ height: 100%;
+ width: 20px;
+ font-size: 12px;
+ font-weight: normal;
+ -webkit-font-smoothing: antialiased;
+
+ -webkit-transition: opacity 0.3s ease-in-out 0s;
+ -moz-transition: opacity 0.3s ease-in-out 0s;
+ -ms-transition: opacity 0.3s ease-in-out 0s;
+}
+
+.content h1:hover .header-anchor, .content h2:hover .header-anchor, .content h3:hover .header-anchor, .content h4:hover .header-anchor, .header-anchor:hover {
+ opacity: 1;
+ text-decoration: none;
+}
+
+.header-anchor:before {
+ content:'#';
+}
Please sign in to comment.
Something went wrong with that request. Please try again.