lbry.tech/app/components/client/glossary-scripts.js
ポール ウェッブ af2cbe7a1d Closes #133
2018-08-30 16:53:52 -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}`);
});