Create Responsive and Beautiful Full-page Lightbox with BaguetteBox.js

There are dozens of lightbox plugins and they’re all good for opposite reasons. Some work improved on portfolio sites while others are best for responsive layouts.

But, one of my favorite new plugins to use is baguetteBox.js, combined by JavaScript developer Marek Grzybek.

Of course, this plugin is totally giveaway to use and open-sourced on GitHub if we wanna puncture into a formula manually.

The library does not have any dependencies, so we can run it but jQuery, Zepto, or anything else. It’s a pure JavaScript library with a unequivocally elementary setup.

It’s meant to work ideally on mobile devices, so it can support swipes and taps, along with a default function on desktops laptops. It’s one of a few full-screen galleries that support mobile interactions, along with a full modal effect.

Check out a demo page to see it live in action. It has a entirely featured gallery, along with a one line of formula compulsory to get it working:'.baguetteBoxOne');

So, this targets a enclosure component with a category .baguetteBoxOne and a whole gallery works off that.

You could set tradition options if we wish for things like captions, symbol styles, preload features, and callback methods for onclick/onchange events. All of these options are well-documented on GitHub if we wanna dive in.

baguetteBox.js slideshow previewbaguetteBox.js slideshow preview

But, it unequivocally doesn’t take many to get this going over a enclosure component and some simple picture elements.

You have full control over a animations, picture sizes, appropriate effects, and gallery calm such as titles/captions. This does need JavaScript, so it doesn’t have a pristine CSS choice to a modal. But, given many browsers support JavaScript it shouldn’t be a problem.

To learn more, revisit a baguetteBox.js categorical page and we can also share your thoughts with a creator on Twitter @feimosi.

Add Comment