lbry.tech/app/views/partials/glossary-scripts.js

27 lines
513 B
JavaScript
Raw Normal View History

2018-07-27 17:18:29 +02:00
/* global $, document */ "use strict";
/**
* Add page-specific styling
*/
document.getElementsByTagName("body")[0].classList.add("glossary");
2018-07-27 17:18:29 +02:00
/**
* Toggle sidebar
*/
$("[data-action='toggle glossary sidebar']").on("click", () => {
2018-07-27 17:18:29 +02:00
$("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}`);
});