VictoriaMetrics/docs/_includes/extra/script.js
Roman Khavronenko bd6b8f7e31
move github-pages docs to the main repo (#1432)
* move github-pages docs to the main repo

* rm github actions for copying docs to VictoriaMetrics/VictoriaMetrics.github.io
2021-07-05 14:34:10 +03:00

17 lines
560 B
JavaScript

/* When in mobile layout, the anchor navigation for submenus
* doesn't work due to fixed body height when menu is toggled.
* This script intercepts clicks on links, toggles the menu off
* and performs the anchor navigation. */
$(document).on("click", '.shift li.toc a', function(e) {
let segments = this.href.split('#');
if (segments.length < 2) {
/* ignore links without anchor */
return true;
}
e.preventDefault();
$("#toggle").click();
setTimeout(function () {
location.hash = segments.pop();
},1)
});