mirror of
https://github.com/bigchaindb/site.git
synced 2025-02-14 21:10:28 +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;
|
padding-bottom: $spacer;
|
||||||
margin-bottom: ($spacer * 2);
|
margin-bottom: ($spacer * 2);
|
||||||
text-align: center;
|
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…
x
Reference in New Issue
Block a user