-
Hey there, I was looking through the docs but could not find anything regarding my problem so here I am. I want to know if there is a way to handle the user scrolling through the page without the use of js. This is the js code I am using right now which I would like to replace if possible: var prevScrollY = 0;
const handleScroll = () => {
const currentScrollY = window.scrollY;
if (currentScrollY > prevScrollY) {
document.getElementById("navbar").className = "hiddenNavBar";
} else {
document.getElementById("navbar").className = "visibleNavBar";
}
prevScrollY = currentScrollY;
};
window.addEventListener("scroll", handleScroll); |
Beta Was this translation helpful? Give feedback.
Answered by
pharrisee
Nov 20, 2024
Replies: 1 comment 1 reply
-
the templ code is transpiled to go (which in turn 'prints' HTML) before shipping to the browser, templ wouldn't have any way of influencing what happens on the browser. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Revirator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the templ code is transpiled to go (which in turn 'prints' HTML) before shipping to the browser, templ wouldn't have any way of influencing what happens on the browser.