On Sunday, February 28, 2016 at 3:01:35 PM UTC-5, Walter Lee Davis wrote: > > > > On Feb 28, 2016, at 12:36 PM, fugee ohu <fuge...@gmail.com <javascript:>> > wrote: > > > > > > > > On Sunday, February 28, 2016 at 8:51:51 AM UTC-5, Colin Law wrote: > > On 28 February 2016 at 11:44, fugee ohu <fuge...@gmail.com> wrote: > > > Why is adding descriptions a whole javascript task in bluimp image > gallery > > > Couldn't the author have worked it out so that all I'd have to do is > provide > > > the descriptions in the html They provide a data-description option to > use > > > in my html anchor containers but that doesn't do anything by itself > without > > > having to do a significant little bit of js coding Makes me wonder if > > > there's something better than bluimp This is a real bummer as we used > to say > > > > Or to rephrase your question: > > > > Bluimp is a great gem which does almost exactly what I want and I am > > very grateful to the authors for allowing me to benefit from their > > work. There is one little feature missing so I think I will fork > > their code and add that feature and send a pull request back to the > > authors so it can be added to the gem and the whole community may > > benefit. Googling for > > adding descriptions to images displayed in bluimp image gallery > > shows a number of good hits so I don't it should be too difficult. > > > > Colin > > > > Here's the code they provide, I tried but it doesn't have any effect so > far > > > > blueimp.Gallery( > > document.getElementById('links'), > > { > > onslide: function (index, slide) { > > var text = > this.list[index].getAttribute('data-description'), > > For the preceding line to work, your element needs to have the attribute > data-description on it. Does it? > > > node = this.container.find('.description'); > > For the preceding line to work, you need to have an empty HTML element > with the classname description present in the page, within the container > element of the slide (no clue where that means, I'm just interpreting the > code for you). If that element exists, then it will be emptied and > re-filled with the description. > > > node.empty(); > > if (text) { > > node[0].appendChild(document.createTextNode(text)); > > } > > } > > } > > ); > > My guess is that you are missing one or more of these antecedents, and > without them, the JS won't have anything to work with. > > Walter > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to rubyonrails-ta...@googlegroups.com <javascript:>. > > To post to this group, send email to rubyonra...@googlegroups.com > <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/395919ba-62b9-46a1-b3be-b4e2ba84f63c%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view: <div id="links"> <table> <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %> <tr> <% for task in row_tasks do %> <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td> <% end %> <% end %> </tr> </table> </div>
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.