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:06:56
BonginoReport
9 hours agoThe Battle Between Good & Evil w/ Demonologist Rick Hansen - Hayley Caronia (Ep.168)
59.9K17 -
1:12:57
Kim Iversen
4 hours agoBill Gates Suddenly Says “Don’t Worry About Climate Change”?
58.2K31 -
1:05:12
Michael Franzese
4 hours agoI Waited 50 Years to Tell You What Happened on Halloween 1975
13.8K7 -
1:07:15
Candace Show Podcast
4 hours agoINFILTRATION: Charlie Kirk Was Being Tracked For Years. | Candace Ep 256
47.7K196 -
LIVE
Rallied
3 hours ago $0.66 earnedWarzone Solo Challenges then RedSec Domination
105 watching -
2:34:30
Red Pill News
5 hours agoBoomerang Time - DOJ Investigating BLM Fraud on Red Pill News Live
30.2K10 -
1:46:14
Roseanne Barr
6 hours ago“The Over Emotional Are Always Under Informed” | The Roseanne Barr Podcast #121
70.9K44 -
3:24:28
Nerdrotic
7 hours ago $9.50 earnedThe WitcHER DOA | Box Office Massacre | Massive Industry Layoffs - Friday Night Tights 378
39.3K7 -
14:54
IsaacButterfield
15 hours ago $3.48 earnedShe Called Out “Creepy Men It Didn’t End Well
20.7K44 -
11:43:21
LFA TV
23 hours agoLIVE & BREAKING NEWS! | FRIDAY 10/31/25
187K46