Created
June 6, 2022 09:21
-
-
Save zadeviggers/132fd4b2e30b0506a0b7bda9846b1639 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const escaped_fragment_id = CSS.escape(location.hash.slice(1)); | |
const element = document.querySelector(`#${escaped_fragment_id}, a[name="${escaped_fragment_id}"`); | |
element.scrollIntoView(); | |
element.classList.add("fragment-targeted"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment