Nice one. An interesting yet mostly unknown property of classList is that classList.toggle accepts a second argument to force a toggle state, so your code can be reduced:
// Beforeif((rootElement.scrollTop/scrollTotal)>0.25){// Show the buttonscrollToTopBtn.classList.add("isVisible")}else{// Hide the buttonscrollToTopBtn.classList.remove("isVisible")}// AfterscrollToTopBtn.classList.toggle("isVisible",(rootElement.scrollTop/scrollTotal)>0.25)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice one. An interesting yet mostly unknown property of classList is that classList.toggle accepts a second argument to force a toggle state, so your code can be reduced: