1

I'm new to rails and trying to implement a lightbox in rails 4. My question is that how can I write the following code in erb?

<a href="#img1">
  <img src="some_img.jpg">
</a>

<a href="#_" class="lightbox" id="img1">
  <img src="some_img.jpg">
</a>

2 Answers 2

1
<%= link_to image_tag("some_img.jpg"), "#img1" %>

<%= link_to image_tag("some_img.jpg"), "#_", :class => "lightbox", :id => "img1" %>
Sign up to request clarification or add additional context in comments.

Comments

0
%a#img1.lightbox{:href => "#_"}

  %img{:src => "some_img.jpg"}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.