Premium Only Content

Let's Build A Javascript Modal Plugin From Scratch
Welcome to the first of my Javascript Workouts. The aim with this series is to build as many practical Javascript elements as possible - no frameworks, no plugins. Just plain JS.
In this first video, we'll build ourselves a vanilla Javascript modal plugin. We'll setup default configuration options but allow the user to override them. We'll handle the ability to switch between modals, and lastly, we'll emit four custom events: before opening modal, after opening modal, before closing modal, and after closing modal.
My website
https://www.pixelrocket.store
Project Files
https://www.dropbox.com/s/fcymlamp7rkngqq/modal-plugin.zip?dl=0
Custom Events
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
Timestamps
0:00 Intro
0:56 Setup starting files
2:10 Difference between procedural JS and OOP JS
3:25 Setup our modal class
4:30 Constructor function
6:00 Setup default options
11:00 Setup init function
13:28 Setup modal triggers
15:50 Binding inside OOP
21:48 Handle modal open
25:06 Setup modal closers
27:28 Handle modal close
31:08 Setup modal CSS classes
39:10 Handle switching between modals
40:31 Handle custom event dispatching
-
1:21:41
Kim Iversen
3 hours agoNick Fuentes Denies Israel Killed Charlie Kirk | Right-Wing CANCELS Jimmy Kimmel
15.6K91 -
Candace Show Podcast
1 hour agoEXCLUSIVE! Another Photo Of Tyler Robinson | Candace Ep 238
43.3K69 -
2:21:09
Redacted News
3 hours agoWhat are they hiding? New video evidence in Charlie Kirk's Shooting SHAKES FBI'S case | Redacted
126K205 -
41:53
Kimberly Guilfoyle
5 hours agoCharlie's Legacy and Our Mission
28.4K6 -
1:07:55
vivafrei
4 hours agoJimmy Kimmel Out Indefinitely! Trump "Srubs" Study on Right Wing Violence? Clinton Tweet & MORE
192K66 -
1:35:02
The Quartering
4 hours agoNuclear Fallout From Jimmy Kimmel Firing, New Head Of TP USA, Obama Whines
213K74 -
23:35
Jasmin Laine
3 hours ago“We Were Betrayed”—Carney HUMILIATED As His Base REVOLTS Against Him
28.1K13 -
LIVE
LFA TV
20 hours agoKIMMEL GONE | ANTIFA LABELED TERRORISTS! - THURSDAY 9/18/25
986 watching -
LIVE
freecastle
6 hours agoTAKE UP YOUR CROSS- Hope In GOD, and Fear NO Evil!
45 watching -
1:34:10
The HotSeat
3 hours agoChapter 32 Begins: Honoring Charlie Kirk’s Legacy & Jimmy Kimmel Gets Canceled
22.9K6