Permalink
Browse files

Set highlight style to the active anchor

  • Loading branch information...
1 parent 0d8f0ac commit 5938db14594063ed9c01070bc02154002ce09df7 @tchandelle tchandelle committed Jan 11, 2017
@@ -114,4 +114,22 @@ $(function () {
});
stabilityToggle.prop('checked', search === '?stableonly=true');
unstable.toggleClass('hidden', stabilityToggle[0].checked);
+
+
+ // Highlighting current anchor
+
+ var anchors = $('.anchor');
+ var _onHashChange = function () {
+ var activeHash = window.document.location.hash
+ .replace(/\./g, '\\.'); // Escape dot in element id
+
+ anchors.removeClass('highlighted');
+
+ if (activeHash.length > 0) {
+ anchors.filter(activeHash).addClass('highlighted');
+ }
+ };
+
+ $(window).on('hashchange', _onHashChange);
+ _onHashChange();
});
@@ -51,6 +51,9 @@ body {
width: 0px;
height: 0px;
}
+.nameContainer .anchor.highlighted + h4 {
+ background-color: #faebcc;
+}
a {
position: relative;
z-index: 1;

0 comments on commit 5938db1

Please sign in to comment.