Merge pull request #425 from vincent99/master

Only show "On this page" if there are links to show
This commit is contained in:
Vincent Fiduccia
2018-07-10 12:24:39 -07:00
committed by GitHub
3 changed files with 15 additions and 5 deletions
+1
View File
@@ -36,4 +36,5 @@ RUN stat /run/public/index.html
FROM nginx
VOLUME /usr/share/nginx/html/docs
COPY --from=build /run/public /usr/share/nginx/html/docs/
COPY gulpfile.babel.js /usr/share/nginx/html/docs/
COPY nginx.conf /etc/nginx/conf.d/default.conf
+1
View File
@@ -35,4 +35,5 @@ RUN stat /run/public/index.html
FROM nginx
VOLUME /usr/share/nginx/html/docs
COPY --from=build /run/public /usr/share/nginx/html/docs/
COPY gulpfile.babel.js /usr/share/nginx/html/docs/
COPY nginx.conf /etc/nginx/conf.d/default.conf
+13 -5
View File
@@ -65,18 +65,26 @@ const bootstrapDocsSearch = function() {
overlay.toggleClass('open');
if (container.hasClass('open')) {
$('input#search').focus();
$('input#search-box').focus();
}
overlay.css({top: 120});
});
}
const bootstrapDocsJS = function() {
bootstrapDocsSearch();
const bootstrapIdLinks = function() {
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(() => {
bootstrapDocsJS();
bootstrapDocsSearch();
bootstrapIdLinks();
});