0

I'm using the Lightbox 2 module on Drupal 7. I have added an image field to my Basic Page content type. On one particular page, I have uploaded several images into that field, which I then inserted into the body (text format: Full HTML) using the Insert module.

Since the images are small, I want to allow users to click on them to open them in a lightbox on the same page. I read through the lightbox documentation but it seems like it hasn't really been updated for Drupal 7.

I tried the following:

<a href="/sites/default/files/styles/medium/public/page_screenshots/review.png" rel="lightbox" class="image-large" title="review">
<div style="text-align: center;"><img src="/sites/default/files/styles/medium/public/page_screenshots/review.png" alt="review" title="review" class="image-medium" /></div>
</a>

However, in this case, when I click the image, nothing happens. When I add some text, however, like this:

<a href="/sites/default/files/styles/medium/public/page_screenshots/review.png" rel="lightbox" class="image-large" title="review">
click here for the image</a>

The lightbox appears when the text is clicked. However, I want to show the lightbox when an image is clicked, not when text is clicked. How can I do this?

1

I think the Lightbox is not really the best choice for Drupal 7. Have a look at the very powerfull Colorbox Module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.