How to: Open a different image in a Lightbox by clicking an image in Divi
Below is an extract from our ‘Tips & Tricks‘ page.
An example of this particular scenario can be seen on the Home page. If you click the ‘Gravityscan’ image, another image will open. It is slightly different because the Gravityscan image is a badge produced from the Gravityscan website. This is because it is updated daily by Gravityscan after the site is scanned. However, the principle is the same – its just the image source (img src) differs.
To achieve this, a ‘Code’ module has been used. Paste the code below into the Code Module
Change the path/file name of both the image to be displayed on the page AND the image to open in the lightbox. Adjust the width of the image to be displayed on the page. You can add a ‘title’ to the code between the inverted commas (title=””) if you wish and this will be displayed on hovering over the image and in the lightbox as a caption.