The simplest type and the most lightweight code for LightBox/Modal/Ajax Popup for your websites, wordpress, joomla, etc.
Nishant Arora30/Apr/2012
Facebook
Twitter
LinkedIn
Reddit
Working on client's projects, introduce you to different set of problems and then you set out to improvise on how to get through them. Most of the time my client come up with demands to put up a lightbox on their websites to display slick content on their sites. They are called with different names, some call it the Modal Box, some call it the lightbox, the effect is the same, a translucent background with a window in the middle showing content like sign up forms, opt-in forms, video boxes, etc.
[caption id="" align="aligncenter" width="500"] A Facebook Modal Box[/caption]
You can google for numerous ways to implement this using jQuery, Mootools and other frameworks but I was looking for somethng much more lighter than loading the jQuery or Mootools Libs. Now, when I set out to develop a simple solution for my client, I came across Emanuele Feronato's Blogwhere she has written some CSS-JS based lightbox code, but it has its own short comings, like cannot control the video player, i.e the video player keeps on running even after the box is closed.
So I basically improvise on her code to make it much more realistic and practical. So staring with the programming part:
Step 1: CSS - We are going to define two div classes one for the translucent overlay and one for the window in the middle containing stuff.
Step 2: DIVs - Now we need two divs to be rendered along the page
Step 3: JavaScript - Writing the functions to control the divs
So that's it!, you get a completely customizable, extensible, robust and a light weight lightbox, modal box popup. In case you like it, have questions or develop over it, please lemme know!