fix for '_' in hash and with '?'

This commit is contained in:
yashsinghcodes
2024-05-15 06:15:06 +00:00
parent d43e6b4db7
commit 8ec6c0c074
+5 -1
View File
@@ -332,8 +332,12 @@ const Docs = (defaultprops) => {
const scrollToHash = () => {
const hash = window.location.hash.replace("#", "")
var hash = window.location.hash.replace("#", "").replaceAll("_", "-");
if (hash.includes('?')) {
hash = hash.split('?')[0]
}
if (hash) {
console.log("HASH: ", hash)
const element = document.getElementById(hash)
if (element) {
element.scrollIntoView({