Comments (1)
Hi there @neal-wilxite! Thanks for opening this question. Since the caption
config option also takes a function, I think we should be able to make this work.
As shown in the example, caption (in the function style) is called with the trigger element (in your case, the links). So, in your case, the following config/code should work:
function initLuminous(options) {
let config = options || {};
let lightboxLinks = document.querySelectorAll(".lightbox-link");
if(lightboxLinks.length == 1){
if(config.caption){
config.caption = lightboxLinks[0].dataset.caption;
}
new Luminous(lightboxLinks[0], config);
}
if(lightboxLinks.length > 1){
// TODO: ADD CAPTIONS FOR MULIPLE IMAGES??
new LuminousGallery(lightboxLinks, config);
}
}
let options = {
caption: (trigger) => trigger.querySelector('img').getAttribute('data-caption');
}
initLuminous(options);
I'll close this for now, but if you have any more questions, please feel free to comment on this issue!
from luminous.
Related Issues (20)
- Separate basic theme and "fullscreen"-esque mode HOT 1
- injectBaseStyles not setting HOT 2
- Add option to set caption (suggestion) HOT 2
- I want to give a class name to the enlarged image. HOT 2
- Demo url on documentation leads to 404 error
- Action Required: Fix Renovate Configuration
- is it possible to use luminous in vue.js? HOT 1
- Dependency Dashboard
- Include license in distributed JS HOT 3
- closetrigger? HOT 2
- The image file's height is over when the image is big size HOT 6
- The automated release is failing 🚨
- Keyframe rule ignored due to bad selector. HOT 2
- Small viewport sizes don't scale the image properly HOT 3
- Arrows are not in the vertical center of the image HOT 1
- onChange doesn't work HOT 1
- What is the proper way to import LuminousGallery?
- Direct including a script from CDN (Unpkg, jsDelivr, ...)
- Call for Maintainer(s) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luminous.