How to add lightbox functionality to images in the body
The following is a guide to adding lightbox functionality to images in your content body area, this guide does require some basic knowledge of HTML and may not be necessary depending on what version of the Drupal content management system you are using.
This guide assumes you're logged into your website. The first step is to upload the larger versions of the image you wish to show in the lightbox, this may not be necessary if the large image is already on the website or you are using text to link to your lightbox.
Uploading the larger images you want to display in the lightbox
- In the body click the image properties icon
- Click the "Browse Server" button
- Select the appropriate folder e.g. images or pics
- Click the "Upload" button and browse and select the image from your computer
- Insert the image into the "Image properties" window
- Copy the path of the image from the path field
- Click the cancel button so the image is not added to your body content
Add the content that you wish to link to the lightbox
-
This may be adding a thumbnail if so upload the thumbnail and add it to your body content - follow steps 1-5 then:
- Add content to the alternative text field
- Click ok
- Position your image in the body
- Select the text or image and click the link button in the tool bar
- Paste in path to the large image in the URL field
- In the link window change the tab over to "Advanced"
- Enter a description of the image into the "Advisory Title" field
- Click ok
Editing the code of your body to allow the lightbox to work
In order to turn the link you have just created into a link that will show up in lightbox do the following:
- In the tool bar click the "Source button
- This will show you the HTML code of your story
- Find the HTML for your link you have just created
-
add the "rel" attribute to the link as follows:
<a href="/sites/www.klixo.co.nz/files/images/example-large.jpg" rel="lightbox[gallery]" title="Example description">
<img alt="example alternate text" src="/sites/www.klixo.co.nz/files/images/example-small.jpg" title="Example image title" />
</a> -
Save your page or story and test