Minimalist Fullscreen Image Viewer/Lightbox In JavaScript – IMG-BOX

Category: Javascript , Modal & Popup | June 20, 2018
Author:krittanon-w
Views Total:5,979 views
Official Page:Go to website
Last Update:June 20, 2018
License:MIT

Preview:

Minimalist Fullscreen Image Viewer/Lightbox In JavaScript – IMG-BOX

Description:

IMG-BOX is a dead simple JavaScript plugin to display your image in a fullscreen lightbox popup.

More features:

  • Custom background overlay.
  • Hides scrollbar when the lightbox is activated.
  • Fade in/out animations.

How to use it:

Just insert the JavaScript file into the document and we’re ready to go.

<script src="img_box.js"></script>

Display the original image in the lightbox.

<img src="1.jpg" onclick="img_box(this)">

Display another image in the lightbox.

<img src="thumb.jpg" onclick="img_box('large.jpg')">

Customize the image lightbox by overriding the following options.

// background color
var bg_color_img_box = 'rgba(0,0,0,0.9)'
// hides scrollbars
var allow_hide_scroll_img_box = 'yes'
// enables fade in/out animations
var use_fade_inout_img_box = 'yes'
// animation speed
var speed_img_box = 0.08
// z-index
var z_index_dv_img_box = 999

You Might Be Interested In:


2 thoughts on “Minimalist Fullscreen Image Viewer/Lightbox In JavaScript – IMG-BOX

  1. Andy

    Beautiful – this is absolutely what I needed! I’ve just spent the best part of 2 hours fiddling about with another plugin (and realised that I would have been better off just writing it myself…) and then I stumble on your solution. Great work!

    Reply

Leave a Reply