Verified Commit 8c9f27de authored by Camil Staps's avatar Camil Staps 🚀

Detect hash change (after search) to open corresponding collapsable

parent 759060af
Pipeline #14542 failed with stage
in 54 seconds
......@@ -48,14 +48,17 @@ function make_relative_url(url) {
}
/* Open collapsable of hashtag in url */
if (window.location.hash.substring(0,1) == '#') {
let id = window.location.hash.substring(1);
let elem = document.getElementById(id);
if (elem.classList.contains('collapsable')) {
let head = elem.querySelector('.collapsable-head');
head.onclick();
window.onhashchange = function () {
if (window.location.hash.substring(0,1) == '#') {
let id = window.location.hash.substring(1);
let elem = document.getElementById(id);
if (elem.classList.contains('collapsable')) {
let head = elem.querySelector('.collapsable-head');
head.onclick();
}
}
}
};
window.onhashchange();
/* search field */
let searchfield = document.getElementById('search-field');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment