These are chat archives for idiot/unslider

29th
Jun 2016
Urs Bräm
@ursbraem_twitter
Jun 29 2016 20:37
Hi! I'm trying to access a caption that's set in a data attribute of a slide. Like this : <img data-caption="bla"/> .
Now I'd like to do this
    slider.on('unslider.change', function(event, index, slide) {
        console.log('caption: '+slide.data("caption"));
    });
That returns "undefined". How do I access the "slide" object's data?
Urs Bräm
@ursbraem_twitter
Jun 29 2016 20:45
Ah got it. The code is fine. .data() is the right way to access a jQuery Object's data attribute. <li data-caption="bla"><img/></li> is the right structure, as the slide is li, not img as I wrote it