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

In my view:

<%= 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

In my view:

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

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

<a href= "<%= task.name %>" 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:

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