Search code examples
jqueryhtmlimagelightbox2

jquery lightbox is not working


I am trying to set custom width and height on lightbox image popup but i am getting error $(...).lightBox is not a function

Jquery version: 1.12

lightbox version: 2.9

Following is my html code:

<html>
    <head>
            <script src="js/jquery.js"></script>
            <link href="css/lightbox.min.css" rel="stylesheet">
            <script src="js/lightbox.min.js"></script>  
            <script>
                $(document).ready(function(){
                    $('a').lightBox({
                          maxHeight: 700, 
                          maxWidth: 700
                    });
                });
            </script>
    </head>

    <body>
        <a style="color: blue" href="images/sampleinvoice.jpg" data-lightbox="sampleinvoice" data-title="Sample Invoice">Sample Invoice</a>
    </body>

</html>

Any suggestions?


Solution

  • After looking more into http://lokeshdhakar.com/projects/lightbox2/#options, i found that following is correct way to customize lightbox

                    lightbox.option({
                        maxHeight: 1000, 
                          maxWidth: 1250
                    });