mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-26 13:08:11 +00:00
Add anchor links to headers on hover
This commit is contained in:
+12
-4
@@ -72,13 +72,21 @@ const bootstrapDocsSearch = function() {
|
|||||||
|
|
||||||
overlay.css({top: 120});
|
overlay.css({top: 120});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bootstrapDocsJS = function() {
|
const bootstrapIdLinks = function() {
|
||||||
bootstrapDocsSearch();
|
const container = '.wrapper ARTICLE';
|
||||||
|
const selector = 'h2[id], h3[id], h4[id], h5[id], h6[id]';
|
||||||
|
$(container).on('mouseenter', selector, function(e) {
|
||||||
|
$(e.target).append($('<a />').addClass('header-anchor').attr('href', '#' + e.target.id).html('<i class="material-icons p-l-xs" aria-hidden="true">link</i>'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$(container).on('mouseleave', selector, function(e) {
|
||||||
|
$(e.target).parent().find('.header-anchor').remove();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
bootstrapDocsJS();
|
bootstrapDocsSearch();
|
||||||
|
bootstrapIdLinks();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user