html - Add image within an <a></a> in rails -
i trying add image tag within tag in rails. here original code:
<a href="assets/img/main/img9.jpg" title="project one" data-rel="gallery" class="thumbnail fancybox"> <img alt="" src="assets/img/main/img9.jpg" class="full-width img-responsive"> <span class="portfolio-box-in rounded-x"> <i class="r icon-magnifier-add"></i> </span> </a>
here rails translation when try translate rails not same supposed in original code.
<%= link_to "creative/main/img18.jpg", :class => "thumbnail fancybox", data_rel:"gallery", title: "project three" %> <%= image_tag "creative/main/img18.jpg", :class => "full-width img- responsive" %> <span class="rounded-x portfolio-box-in"> <i class="icon-magnifier-add"></i> </span> <%end%>
and when click on magnifying glass looks this:
on translation not show magnifying glass , when click on it looks second picture.
any right format appreciated.
update
i tried suggested me:
<%= link_to image_path("creative/main/img18.jpg"), class: "thumbnail fancybox", data: { rel: "gallery" }, title: "project three" %> <%= image_tag "creative/main/img18.jpg", class: "full-width img-responsive" %> <span class="rounded-x portfolio-box-in"> <i class="icon-magnifier-add"></i> </span> <% end %>
when tried didn't full magnifying glass , when click on image not load larger image:
update 2
i examined html generated , doesn't appear off original:
generated suggestion:
<a class="thumbnail fancybox" data-rel="gallery" title="project three" href="/image.creative%2fmain%2fimg18.jpg"> <img class="full-width img-responsive" src="/assets/creative/main/img18-972c688b1a840ae0a8ec9b22012ae6c4aa69ca6894da2029277fa2c163b41fc0.jpg" alt="img18" /> <span class="rounded-x portfolio-box-in"> <i class="icon-magnifier-add"></i> </span> </a>
here original html working code:
<a href="assets/img/main/img18.jpg" title="project three" data-rel="gallery" class="thumbnail fancybox"> <img alt="" src="assets/img/main/img18.jpg" class="full-width img-responsive"> <span class="portfolio-box-in rounded-x"> <i class="r icon-magnifier-add"></i> </span> </a>
this not tested code, can try once:
<%= link_to image_path("creative/main/img18.jpg"), class: "thumbnail fancybox", data: { rel: "gallery" }, title: "project three" %> <%= image_tag "creative/main/img18.jpg", class: "full-width img-responsive" %> <span class="rounded-x portfolio-box-in"> <i class="icon-magnifier-add"></i> </span> <% end %>
Comments
Post a Comment