In HTML I would write:
<div class="imageRow">
<div class="single">
<a href="image.jpg" rel="lightbox" title="my caption">
<img alt="" src="imagethumb.jpg">
</a>
</div>
</div>
But I have to adapt it for ruby on rails and I'm quite new to it... so I tried:
<div class="imageRow">
<div class="single">
<a href=<%= link_to image_tag("image.jpg") %> rel="lightbox" title="my caption">
<%= image_tag("imagethumb.jpg") %>
</a>
</div>
</div>
...but it doesn't work as the "rel="lightbox" title="my caption">" part is not applied but appears written on the html part + I see the 2 images while I should only see "imagethumb".
I also tried:
<div class="imageRow">
<div class="single">
<%= link_to image_tag("image.jpg", :rel=>"lightbox", :title=>"my caption")
<%= image_tag("imagethumb.jpg") %>
%>
</div>
</div>
I see both image too...
What should I do to obtain the equivalent of the HTML code I wrote up?
Try this
<%= link_to image_tag("imagethumb.png", :alt => ""), "image.jpg", :rel => "lightbox", :title => "my caption" %>
P.S: Untested
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With