toggle class onscroll hook react
const [scroll, setScroll] = useState(0)
useEffect(() => {
document.addEventListener("scroll", () => {
const scrollCheck = window.scrollY < 100
if (scrollCheck !== scroll) {
setScroll(scrollCheck)
}
})
})
Also in JavaScript:
- select2
- js reduce a array of straing
- how to copy to clipboard in p5.js
- Basic JavaScript: Use Recursion to Create a Range of Numbers
- angular coding examples
- random hexadecimal character js
- javascript write to firebase
- int to octal javascript
- js date difference in seconds
- js save files
- json parsing techniques in api
- jquery basic authenticated get user
- node server code
- deploy angular app on google app engine
- keyboard key codes
- async await iife
- jquery cdn w3schools
- how to wait till jquery post request has been made
- add component in angular router
- jquery set title attribute
- how to return a string x amount in javascript without using . repeat
- js get transition duration
- button click event listener angular
- v-switch vuex store