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
-
LIVE
Badlands Media
9 hours agoBadlands Daily: November 11, 2025
3,843 watching -
1:30:38
Graham Allen
2 hours agoLibs Are SEETHING Over Shutdown Ending!! They’re Turning On Each other!! + Trump Calls Out MTG!!
109K595 -
LIVE
Wendy Bell Radio
5 hours agoEverything’s A Grift
7,441 watching -
12:03
Bearing
3 hours agoTransgender Women BANNED From the Olympics 🦀
3.85K15 -
1:10:48
Chad Prather
10 hours agoPeace That Walks Through Walls: Finding Faith in a Fearful World
71.8K14 -
LIVE
LFA TV
12 hours agoLIVE & BREAKING NEWS! | TUESDAY 11/11/25
3,361 watching -
8:27
MattMorseTV
17 hours ago $20.76 earnedIlhan Omar IMPLICATED in $250,000,000 FRAUD RING.
52.5K149 -
1:58:13
The Chris Salcedo Show
14 hours ago $4.71 earnedOur Vets Fought To Turn Over Our Country To Marxists & Leftists?
27.6K1 -
15:11
Cash Jordan
17 hours agoIllegals ‘Force Out’ NYC Millionaires… "Communist" Mayor FREAKS as RESIDENTS LEAVE
59.9K34 -
43:03
RiftTV
9 hours agoLeftists Scheme To Destroy the Economy | Guest: Brad Miller | DC Dive
42.5K6