I can't get data-description working in bluimp-image-gallery

In my view:

" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %>

In my js file:

blueimp.Gallery(
document.getElementById(‘links’), {
onslide: function (index, slide) {
var text =
this.list[index].getAttribute(‘data-description’),
node = this.container.find(’.description’);
node.empty();
if (text) {
node[0].appendChild(document.createTextNode(text));
}
}
});

document.getElementById(‘links’).onclick = function (event) {
event = event || window.event;
var target = event.target || event.srcElement,
link = target.src ? target.parentNode : target,
options = {index: link, event: event, onslide: function (index,
slide) {
var text =
this.list[index].getAttribute(‘data-description’),
node = this.container.find(’.description’);
node.empty();
if (text) {
node[0].appendChild(document.createTextNode(text));
}
} },
links = this.getElementsByTagName(‘a’);
blueimp.Gallery(links, options);
};

Hi

On Tue, Mar 1, 2016, at 07:44, fugee ohu wrote:

In my view:

" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %>

I don’t know if it’s typo in your mail or you just don’t notice but
this:

" data-description = "<%= task.comment %>" data-gallery >

will have an empty data-description attribute because there are spaces
between the equal sign so they just become another attributes
(data-description = “content” -> three different attributes, two of
which are invalid).

Correct one is: