0.2.4 • Published 6 years ago

cloudinary-lightbox v0.2.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Cloudinary Lightbox

A JavaScript widget for auto-generating responsive, accessible lightboxes using Cloudinary.

All Contributors

Installing

Using a CDN

The quickest way to get started is to add the minified production bundles from the Unpkg CDN:

Place the following default theme CSS before the closing </head> tag:

<link href="https://unpkg.com/cloudinary-lightbox@latest/dist/cloudinaryLightbox.css" rel="stylesheet" type="text/css">

Place the following script before the closing </body> tag:

<script src="https://unpkg.com/cloudinary-lightbox@latest/dist/cloudinaryLightbox.js"></script>
<script>
    var CloudinaryLightbox = CloudinaryLightbox({
        cloudName: "YOUR_CLOUD_NAME"
    })
</script>

Using NPM

If you're looking to include the plugin as a part of your build process, install using NPM:

npm install cloudinary-lightbox

Then include the files as necessary in your app entrypoint, e.g in Parceljs:

import CloudinaryLightbox from "cloudinary-lightbox"
import "cloudinary-lightbox/dist/cloudinaryLightbox.css"

const cloudinaryLightbox = new CloudinaryLightbox({
    cloudName: "YOUR_CLOUD_NAME"
})

Usage

Cloudinary Lightbox is plug-and-play out of the box. The default stylesheet will give you fullscreen image lightboxes for every image you select when instantiating the plugin.

Configuration

When instantiating the plugin, the following options are available:

NameTypeDescriptionDefault
selectorsstringA comma delimited list of valid CSS selectors to target specific imagesimg
attributes.srcstringThe HTML attribute to search for the image src value from.src
attributes.transformsstringThe HTML attribute to search for Cloudinary transform values on. Must be a comma delimited list of valid Cloudinary transforms.data-clb-transforms
cnamestringThe domain name that Cloudinary URLs should be constructed with.res.cloudinary.com
privateCdnbooleanWhether a private CDN is being used. For advanced tier Cloudinary users onlyfalse
securebooleanWhether to use https protocol, even if the viewed webpage is httptrue
wrapperSelectorsstringA comma delimited list of valid CSS selectors to source transforms from. Useful for markdown content.undefined
templatestringA valid mustachejs template for rendering the lightbox. Use the {{{ image }}} variable to place the generated image.Default template
transformsstringThe default transforms to apply if none are set using attributes.transformsw_auto,c_scale,dpr_auto

Custom Styling (CSS)

If you want to customize the CSS for the lightbox, feel free to exclude or extend the very basic default theme with your own CSS.

Client Hints

By default, this plugin is setup to deliver the best image possible via client hints. To enable this functionality, add the following to the <head> of your page:

<meta http-equiv="Accept-CH" content="DPR, Viewport-Width, Width">

Contributors

Thanks goes to these wonderful people (emoji key):

chrisdmacrae💻(https://github.com/forestryio/Cloudinary Lightbox/commits?author=chrisdmacrae "Code")

This project follows the all-contributors specification. Contributions of any kind welcome!

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago