[TASK] refactor queryselector
- ignore only #-hrefs
This commit is contained in:
parent
6302b59647
commit
3b81a6240b
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"gitea.repo": "ferienwohnung-wanderlust"
|
||||
}
|
||||
@ -20,15 +20,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
}
|
||||
|
||||
var hashAnchors = document.querySelectorAll("a[href^='#']");
|
||||
var hashAnchors = document.querySelectorAll("a[href^='#']:not([href='#'])");
|
||||
for (var i = 0; i < hashAnchors.length; i++) {
|
||||
if (hashAnchors[i].getAttribute("href") != "#") {
|
||||
hashAnchors[i].onclick = function () {
|
||||
var target = this.getAttribute("href");
|
||||
scrollToElement(target);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user