dbrekalo / simpleLightbox

SimpleLightbox is lightweight and responsive lightbox library with no dependencies. Display images, galleries, videos or custom content and control your lightbox with easy to use api.
http://dbrekalo.github.io/simpleLightbox/
MIT License
263 stars 76 forks source link

How to use image with no link wrap #3

Closed sagive closed 6 years ago

sagive commented 6 years ago

I am trying to apply an auto lightbox on all images inside a post. Getting the relevant selector attached is easy but i thing the plugin looks only for the HREF attr?

How can i get an image to work directly using its SRC attr?

sagive commented 6 years ago

Sorry, i got it. Just needed to look at the class unMinified (nicly organized) - here is an example for anyone looking to do the same:

$('.wrraper img').simpleLightbox({
        captionAttribute: 'alt', // choose data source for library to glean image caption from
        urlAttribute: 'src', // where to expect large image
});