How to create image preview?

98 Views Asked by At

I am trying to implement lighbox2 to my website, however, it does not work as presented. On the official website, it shows the preview but I cannot get it to show it. It just says "Image 1" as a text and then when I click, the image is properly displayed. Should I enable anything? I followed the official tutorial.

My index.html

<!DOCTYPE html>
<html lang="sk" class="h-full">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://cdn.tailwindcss.com"></script>
        <link href="lightbox2-2.11.4/dist/css/lightbox.css" rel="stylesheet"/>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
        <title>Maškrtníček</title>
   
        <div class="text-2xl text-center w-full bg-orange-200 py-6" id="fotky">
            <h2 class="text-2xl">Fotky</h2>
            <a href="pictures/proxy-image.png" data-lightbox="image-1" data-title="My caption">Image #1</a>
        </div>
       
    </body>
</html>`

Thank you.

When I use <img class="example-image" src="pictures/proxy-image.png" alt="Golden Gate Bridge with San Francisco in distance"> instead, loads something but the image is not clickable.

1

There are 1 best solutions below

1
Jono Leeds On

href="pictures/proxy-image.png" and src="pictures/proxy-image.png" Are linking to the same file They should link to 2 seperate files The href=" is the full size image and src=" is a thumbnail image

JonofLeeds