Create websites with TailwindCSS
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
window.addEventListener('scroll', function() {
console.log('scrolling');
});
// Alternative version
window.onscroll = function() {
console.log('scrolling');
};
What's the equivalent of the following in plain JS?
$(window).scroll(function() { }); I'm also looking to animate scroll, e.g.:
$('html, body').animate({scrollTop:1750}, 'slow'); Should I be using
Here is what the above code is doing:
1. On scrolling, the onscroll event is fired.
2. The function is defined.
3. The function is called.
4. The function is anonymous.
5. The function is assigned to the window.onscroll property.
6. The