This repository has been archived by the owner on May 22, 2020. It is now read-only.
Added new configuration options that allow specifying which attribute… #276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A few simple changes:
1.) allows users to specify alternate attributes to use for the data source, title, and footer. These still default to data-remote, data-title, and data-footer, so it won't break anything.
I have images where the src is a dataUrl. I found that I was having to store the string twice, once in the src attribute, and once in the data-remote attribute. With these updates, I can just specify that the data is in the src attribute:
$(myImage).ekkoLightbox({dataSrc: "src"});
2.) I created a new method called _getAttr(element,attr). If the attribute starts with data-, it'll use$(element).data(), otherwise it'll use $ (element).attr().
Users should expect that they can manipulate the values in the data- attributes using the data method. Since data-remote was being accessed directly, any updates made via .data('remote',someUrl); would not get picked up by lightbox. This new method allows accessing the data- attributes via the data method, but, still allows accessing non-data attributes via attr, in order to support the update above for allowing alternate attributes to be specified as the sources for various items.