-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Issue
Leaving out the --data="..." parameter or leaving it empty is not supported by Lightbox2. Currently, there is no default value and image links produced by the lightbox plugin will not be picked up by Lightbox2.
See Initialize with HTML on the [https://lokeshdhakar.com/projects/lightbox2/](Lightbox2 documentation).
Expected behavior
There is a data-lightbox attribute on the image links produced by {% lightbox ... %} even if the --data parameter is empty or missing and the Lightbox2 modal will work.
Actual behavior
There is no or an empty data-lightbox attribute on the image links produced by {% lightbox ... %} if not provided explicitely via the --data parameter and the Lightbox2 modal won't work.
Suggested fix
The lightbox plugin should set default value for the data-lightbox attribute so that Lightbox2 will pick up on the image link.
E.g. in the render method, default the data-lightbox attribute value to @path (which should always be there).
# Check if data is given and otherwise set to default
data = @data.to_s.empty? ? @path : @data
%{<a href="#{src}" data-lightbox="#{data}" data-title="#{@title}"><img src="#{thumbSrc}" alt="#{@alt || @title}" class="#{@class}" style="#{@img_style}"/></a>}