Search code examples
jqueryfancybox-2

Fancybox not working on my page


I've been checking similar posts and none of the solutions I've found have worked. Here's all of those code. I don't get any errors in the console.

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />

        <title>jQuery UI Test Holder</title>

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" type="text/css" media="screen" />

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.pack.js"></script>

        <script>

            $(document).ready(function(){
                $('.open').fancybox({
                    type:"iframe"
                });
            });
        </script>
    </head>

    <body>

        <a class="open" href="https://google.com">OPEN</a>
    </body>
</html>

Solution

  • Syntax error: Remove the extra semicolon ;:

    $(document).ready(function () {
        $('.open').fancybox({
            type: "iframe"     <-- HERE
        });
    });