A simple Light Box in Vanilla JavaScript


#1

Here’s a simple JavaScript Code that will help you write a LightBox of your own. It’s not a fancy as what you will find on the Internet, but with modifications and a few tweaks it could be. I tried tightening up the code as best as I could, but I’m sure someone else could do better. I’ve been writing is vanilla JavaScript for it’s easier to transport from one HTML page to another and you don’t have the overhead of a JavaScript library.

Code Pen of HTML, CSS and JavaScript

I hope someone can find this helpful, for I tried to comment the best I could on the JavaScript.


#2

That looks nice. I bet it would be helpful to someone. It is small and simple to follow.