DEV Community

Cover image for 5 JavaScript Events You NEED To Know ๐ŸŒ
Dom (dcode)
Dom (dcode)

Posted on

5 JavaScript Events You NEED To Know ๐ŸŒ

Everybody has their favourite JavaScript event. No? Just me? Well, either way, here are 5 more to add to your collection ๐Ÿ‘‡

1. offline and online

These events let you know when your user's network connection drops out or comes back online, respectively. Especially helpful for good UX! ๐Ÿ–ผ๏ธ

2. hashchange

This one is perfect for building single page applications, or updating page content without refresh. #๏ธโƒฃ

3. transitionend

You can use this event to react to when a CSS transition finishes - great for building beautiful user interfaces ๐Ÿ“‘

4. load

Maybe you want to do something after an image or page is loaded, or you're just curious how long it takes. Either way, this event will fire off when something loads! ๐Ÿ”ƒ

5. scroll

One of my personal favourites, the scroll event lets you know when the user scrolls down the page. You can do plenty of interesting things with this, but keep handlers for this event light, for performance reasons ๐Ÿšจ๐ŸŽ๏ธ

JavaScript DOM Crash Course

You can find a complete course on the JavaScript DOM which goes over some of the topics covered in this post at the link below ๐Ÿ‘‡
https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1
Course Thumbnail

Happy coding ๐Ÿคญ

Top comments (5)

Collapse
 
khaledmv profile image
Khaled Hossain

โคโคโค Good Job!!

Collapse
 
jeffchavez_dev profile image
Jeff Chavez

Cool. I'll use these on my next project.

Collapse
 
starboysharma profile image
Pankaj Sharma

Thank you so much for sharing ๐Ÿง‘โ€๐Ÿ’ป๐Ÿ˜ƒ

Collapse
 
joelbonetr profile image
JoelBonetR ๐Ÿฅ‡

Like it!
In between the FW+Libs flooded mainstream it's good that someone reminds about webstandards and javascript core API including the DOM ๐Ÿ˜

Collapse
 
sojinsamuel profile image
Sojin Samuel

Thanku dcode