Adding 'title' in the API throws an error #519
-
This is pretty much from the documentation, but throws an error. <script type="module">
import 'https://cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js';
var exampleApi = GLightbox({ selector: null });
exampleApi.insertSlide( {
'href': 'https://picsum.photos/1200/800',
'type': 'image',
'title': 'My Title',
'description': 'Example',
});
exampleApi.open();
</script> throws an error: stimulus.index-b5b1d00e42695b8959b4a1e94e3bc92a.js:7 application #start glightbox.min.js:1 Uncaught TypeError: v.getAttribute is not a function |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Hmm, I thought discussions were for "how to", isn't this a bug? Or an error in the documentation? Or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
-
Oh, or is this because v4 is close to release? Can you give an update on that? If it's available on a CDN perhaps we can start testing, checking the docs, etc. |
Beta Was this translation helpful? Give feedback.
-
I'm going to investigate this more, perhaps there's a conflict on my website. |
Beta Was this translation helpful? Give feedback.
-
yes, I was able to fix it, but not sure about the exact cause. Here's my code, running 3.3 from the jsdelivr cdn. data['member'].forEach(product => {
const slideData = { href: product.thumbnail };
if (product.title)
slideData.title = product.title;
if (product.description)
slideData.description = product.description;
slideData.descPosition = 'right';
exampleApi.insertSlide(slideData);
}) Any update on version 4, @gingerchew? It's such a cool library, it'd be wonderful to have an updated release. |
Beta Was this translation helpful? Give feedback.
Here is a codepen with just that. You can see that the snippet works fine and there is no error.