mirror of
https://github.com/bigchaindb/site.git
synced 2024-12-24 02:16:10 +01:00
auto-link markdown headings
This commit is contained in:
parent
ba11e3f50c
commit
fbd195a460
@ -28,4 +28,18 @@ jQuery(function($) {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Automatically add header links to all Markdown headings
|
||||
//
|
||||
$('.content--page--markdown h1, .content--page--markdown h2').each(function(i, el) {
|
||||
var $el, icon, id;
|
||||
$el = $(el);
|
||||
id = $el.attr('id');
|
||||
icon = '<i class="header-icon">#</i>';
|
||||
if (id) {
|
||||
return $el.prepend($('<a />').addClass('header-link').attr('href', '#' + id).html(icon));
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -17,5 +17,21 @@
|
||||
padding-bottom: $spacer;
|
||||
margin-bottom: ($spacer * 2);
|
||||
text-align: center;
|
||||
|
||||
.header-link {
|
||||
@extend .transition;
|
||||
transition-timing-function: $timing-bounce;
|
||||
display: inline-block;
|
||||
padding: 0 .5rem;
|
||||
opacity: 0;
|
||||
transform: translate3d(20px,0,0) scale(0);
|
||||
|
||||
.header-icon { font-style: normal; }
|
||||
}
|
||||
|
||||
&:hover .header-link {
|
||||
opacity: 1;
|
||||
transform: translate3d(0,0,0) scale(.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user