I started searching for a light weight light box script that did not rely on a script library or frame work in order to help it function. I was not able to find one at the time that did not rely on a library... So I made my own. I have an economy host that does not support gzip so any large scripts I use my users will have to download them which can cause multiple seconds of page display delay.
The Light weight File Sizes
8 kb - lighterbox.js
3.2kb - load.gif
0.9kb - lighterbox.css
0.3kb - overlay.png
0.2kb - prev.gif
0.2kb - next.gif
0.2kb - close.gif
It's around 14kb - total!
The orignal "light box 2" with scripts alone is 190kb...ouch. Remember your users are downloading multiples scripts on your server and every kb here and there adds up and people start leaving your site/content because your site is the one with the loading bar always half full. lol one script isn't that big a deal but several scripts add up. Then there's g-zip that's another story.
Here is an example of How Lighter Box2 works.
below you will see the script along with several examples of how you can pick and choose to include or not include titles and descriptions.
1. The first thing you will do is download LighterBox2 Original and take the folder you extract from the zip file and drop it in the root directory where the files your users will be browsing are (where your index.html file is or index.php whatever you are using).* 4 files instead of 7 (-40%)
2. Next you will insert a link to the Style Sheet right before the closing head tag like this
<link rel="stylesheet" type="text/css" href="lighterbox2/lighterbox2.css" /> </head>
3. then you will insert a link to the script right before the closing body tag like this. (It doesn't have to be exactly before the body tag just make sure it is below the content where you are using the script or else it will not work.)
4. Lastly you will insert the "rel" attribute with a value of "lighterbox" on the anchor tags that you want to use lighterbox2 on and fill the "title" attribute with your descriptions that are linking to your larger image files like this, and for your thumbnails use the alt attribute of the thumbnail to store the title of the image.
<a href="images/bigPicture.jpg" title="Short description here" rel="lighterbox" >
<img src="images/thumbnailPicture.jpg" border="0" alt="us" />
YAY...Test it out!
If you find and bugs that I haven't caught please let me know.