Initial commit
This commit is contained in:
21
_includes/js/timeline-js.html
Normal file
21
_includes/js/timeline-js.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<script>
|
||||
(function(){
|
||||
// init bootstrap tooltips
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
||||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||
return new bootstrap.Tooltip(tooltipTriggerEl)
|
||||
});
|
||||
|
||||
// highlight active year row
|
||||
function highlightYear() {
|
||||
var hashfilter = "tr#" + decodeURIComponent(location.hash.substr(1));
|
||||
document.querySelectorAll("table#timeline tr").forEach(row => { row.classList.remove('table-info'); });
|
||||
if (document.querySelector(hashfilter)) { document.querySelector(hashfilter).classList.add("table-info"); }
|
||||
}
|
||||
// if in initial hash
|
||||
if (window.location.hash) { highlightYear(); }
|
||||
// on hash change
|
||||
window.addEventListener("hashchange", highlightYear);
|
||||
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user