-
-
Save Zegnat/3af4763584ebc491bd08cd32038a2484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function handleLinksToDetails() { | |
var openBasedOnHash | |
(openBasedOnHash = function openBasedOnHash() { | |
const hash = window.location.hash; | |
if (hash.length > 1) { | |
const element = document.getElementById(hash.substr(1)) | |
if (element instanceof HTMLDetailsElement && element.open === false) { | |
element.open = true | |
} | |
} | |
})() | |
window.addEventListener('hashchange', openBasedOnHash, false) | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment