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
-
UPCOMING
Sarah Westall
14 minutes agoNEW STUDY RESULTS: Humans have MAC ID Chips – How Did They Get There? w/ Hazen and Mansfield
-
1:13:40
vivafrei
2 hours agoFire This Police Chief! Mass Shooting in New York! Sean Feucht Smoke Bomb Suspect ON VIDEO & MORE!
75.4K33 -
LIVE
LFA TV
19 hours agoLFA TV ALL DAY STREAM - TUESDAY 7/29/25
1,902 watching -
2:03:25
The Quartering
4 hours agoNYC Lunatic Update, Doxxing Website For Men OWNED, Walmart Stabber Update, 2 Men Buy Baby...
111K20 -
2:48:20
Barry Cunningham
4 hours agoSYDNEY SWEENEY PROVES PRESIDENT TRUMP IS RIGHT! EVERYTHING WOKE TURNS TO....
26.9K8 -
LIVE
The HotSeat
1 hour ago💥 Chuck Schumer MELTS DOWN Over Voter ID! Are Democrats Really This Delusional?
666 watching -
18:15
Clownfish TV
12 hours agoCartoon Network Just Got DROPPED!
5.78K12 -
1:13:26
Russell Brand
5 hours agoShooting RAMPAGE In NYC + Trump HUMILIATES Starmer During UK Visit - SF622
161K53 -
10:21
Colion Noir
7 hours agoCaught On Camera: Armed Veteran With AR-15 Shoots Man Who Fires Into Crowd With Drum Magazine
29.7K18 -
20:37
Degenerate Jay
5 hours ago $0.46 earnedThe Fantastic Four: First Steps Review - Fantastic Or Failure?
11.7K2