lbry.tech/views/partials/glossary-scripts.js
2018-08-22 14:08:44 -05:00

26 lines
513 B
JavaScript

/* global $, document */ "use strict";
/**
* Add page-specific styling
*/
document.getElementsByTagName("body")[0].classList.add("glossary");
/**
* Toggle sidebar
*/
$("[data-action='toggle glossary sidebar']").on("click", () => {
$("body").toggleClass("sidebar-closed");
});
/**
* Add hash to URL bar when sidebar links are clicked
*/
$(".component--glossary-toc li a").on("click", event => {
const hash = event.currentTarget.href.split("#")[1];
history.replaceState({}, "", `#${hash}`);
});