mirror of
https://github.com/osmarks/website
synced 2025-07-04 02:52:53 +00:00
Disable overscroll harder
This commit is contained in:
parent
e1a5a51238
commit
ed9b8cd382
14
src/page.js
14
src/page.js
@ -598,6 +598,13 @@ const nameMappings = {
|
|||||||
"mycorrhiza": "Documentation"
|
"mycorrhiza": "Documentation"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const closeOverlay = () => {
|
||||||
|
if (document.querySelector(".search-overlay")) {
|
||||||
|
document.querySelector(".search-overlay").remove()
|
||||||
|
}
|
||||||
|
document.querySelector("html").style.overscrollBehavior = "none"
|
||||||
|
}
|
||||||
|
|
||||||
// replace login navbar option with search because whatever
|
// replace login navbar option with search because whatever
|
||||||
const loginButton = document.querySelector("nav a:last-of-type")
|
const loginButton = document.querySelector("nav a:last-of-type")
|
||||||
loginButton.href = "#"
|
loginButton.href = "#"
|
||||||
@ -608,6 +615,7 @@ loginButton.onclick = async ev => {
|
|||||||
const overlay = document.createElement("div")
|
const overlay = document.createElement("div")
|
||||||
overlay.classList.add("search-overlay")
|
overlay.classList.add("search-overlay")
|
||||||
document.body.appendChild(overlay)
|
document.body.appendChild(overlay)
|
||||||
|
document.querySelector("html").style.overscrollBehavior = "none"
|
||||||
const input = document.createElement("input")
|
const input = document.createElement("input")
|
||||||
input.type = "text"
|
input.type = "text"
|
||||||
input.placeholder = "Search"
|
input.placeholder = "Search"
|
||||||
@ -638,7 +646,7 @@ loginButton.onclick = async ev => {
|
|||||||
if (ev.key === "Enter" || ev.key === "Backspace") {
|
if (ev.key === "Enter" || ev.key === "Backspace") {
|
||||||
if (input.value === "") {
|
if (input.value === "") {
|
||||||
// quit search mode
|
// quit search mode
|
||||||
overlay.remove()
|
closeOverlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -648,8 +656,6 @@ loginButton.onclick = async ev => {
|
|||||||
|
|
||||||
window.addEventListener("keydown", ev => {
|
window.addEventListener("keydown", ev => {
|
||||||
if (ev.key === "Escape") {
|
if (ev.key === "Escape") {
|
||||||
if (document.querySelector(".search-overlay")) {
|
closeOverlay()
|
||||||
document.querySelector(".search-overlay").remove()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user