Reference articles on history, science, culture and more
Encyclopedia

Lightbox (JavaScript)

JavaScript library

Image credit is listed at the end of this article.

Lightbox is a JavaScript library that displays images and videos by filling the screen, and dimming out the rest of the web page.

The original JavaScript library was written by Lokesh Dhakar. The term Lightbox may also refer to other similar JavaScript libraries. The technique gained widespread popularity due to its simple and elegant style.

The original Lightbox library used two JavaScript libraries, Prototype Javascript Framework and script.aculo.us, for its animations and positioning. In April 2012, the plugin was rewritten for jQuery. The open-source nature of Lightbox encouraged developers to modify and fork the code, resulting in plugins such as Colorbox, Magnific Popup, Slimbox or Thickbox.

Lightbox scripts are dependent upon a browser's JavaScript support. Browsers that do not load the script for whatever reason can instead simply load the image as a separate page load, losing the Lightbox effect but still retaining the ability to display the image.

Watch videos about Lightbox (JavaScript)Explainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Lightbox (JavaScript), written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.