javascriptjqueryhtmlfancyboxfancybox-2

Fancybox does not show image in pop-up


I am trying to show an image with pop-up using Fancybox. But when I click on the image, it only opens the image in the same window. I downloaded Fancybox folder from http://fancyapps.com/fancybox/. I am using demo/lib/source folder into this folder.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="/fancybox/jquery.easing-1.4.pack.js"></script>
<script type="text/javascript" src="/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />

<script type="text/javascript">
$(document).ready(function() {
/* This is basic - uses default settings */

$("a#single_image").fancybox();

/* Using custom settings */

$("a#inline").fancybox({
    'hideOnContentClick': true
});

/* Apply fancybox to multiple items */

$("a.group").fancybox({
    'transitionIn'  :   'elastic',
    'transitionOut' :   'elastic',
    'speedIn'       :   600, 
    'speedOut'      :   200, 
    'overlayShow'   :   false
});
});
</script>

<a id="single_image" href="demo/1_s.jpg"><img src="demo/1_b.jpg" alt=""/></a>

Solution

  • There's nothing fundamentally wrong with your code, I've just tested it and it works.

    Make sure the path to the script is correct (/fancybox/jquery.fancybox-1.3.4.pack.js).

    What is the URL of your page?