fancybox v2 with cloud zoom v3

时间:2013-07-09 15:15:11

标签: jquery gallery zoom fancybox-2

我正在尝试在图库的每个图像上使用内部缩放制作fancybox图库。我在stackexchange上看到很多关于OUTDATED的问题,所以请不要在这个问题上加上一个块,因为它不是重复的。我正在使用cloudzoom创建的模板来创建fancybox图库。我设法创建了画廊。到目前为止:

  • 缩放功能适用于图库。
  • 关闭图库后,它不再打开。

<head>
    <title>Cloud Zoom</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <!-- Include jQuery. -->
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>

    <!-- Include Cloud Zoom CSS. -->
    <link rel="stylesheet" type="text/css" href="cloudzoom.css" />

    <!-- Include Cloud Zoom script. -->
    <script type="text/javascript" src="cloudzoom.js"></script>

    <LINK type="text/css" href="http://website-dev.uk.local.com/mcmap/fancyBox/source/jquery.fancybox.css" rel="Stylesheet" >
    <SCRIPT type="text/javascript" src="http://website-dev.uk.local.com/mcmap/fancyBox/source/jquery.fancybox.pack.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="http://website-dev.uk.local.com/mcmap/fancyBox/source/jquery.fancybox.js"></SCRIPT>

    <!-- Call quick start function. -->
    <script type="text/javascript">
        //CloudZoom.quickStart();
        $(function() {
            $('.fancybox').fancybox({
                padding: 0,
                background: 'none',
                transitionIn: 'fade',
                transitionOut: 'fade',
                overlayOpacity: .9,
                afterShow:function(){
                    //$(this).attr('id','zoom');
                    $('.fancybox-skin').css("background","transparent");
                    this.inner[0].childNodes[0].id = 'zoom';
                    this.inner[0].childNodes[0].classList.add("cloudzoom");
                    $(this.inner[0].childNodes[0]).attr("data-cloudzoom","zoomImage: 'images/large/seismic_Adriatic_L1.jpg', zoomPosition:'inside'");
                    CloudZoom.quickStart({tintOpacity:1});
                    console.log(this);
                    //console.log(this.inner[0].childNodes[0]);
                },
                beforeClose: function(){
                    //$('.cloudzoom').data('CloudZoom').destroy();
                    $('.cloudzoom').each(function(){
                          $(this).data('CloudZoom').destroy();
                    });
                    this.inner[0].childNodes[0].id = '';
                    $(this.inner[0].childNodes[0]).removeClass("cloudzoom");
                    $(this.inner[0].childNodes[0]).removeAttr("data-cloudzoom");


                }
            });
        });
        function openfancybox() {
            $(".fancybox").trigger("click");

        }
    </script>    
</head>

<body>


<a href=# onclick="openfancybox()">fancybox</a>


<div id=seisUrl style="display:none">

<a  href="images/small/seismic_Adriatic_L1_small.jpg" class="cloudzoom-gallery fancybox"  data-cloudzoom="useZoom: '#zoom', image: 'images/small/seismic_Adriatic_L1_small.jpg', zoomImage: 'images/large/seismic_Adriatic_L1.jpg',zoomPosition:'inside'" rel="seismicgallery">Image 1</a>

<a href="images/small/image2.jpg" class="cloudzoom-gallery fancybox" data-cloudzoom = "useZoom: '#zoom', image: 'images/small/image2.jpg', zoomImage: 'images/large/image2.jpg'" rel="seismicgallery">Image 2</a>

<a href="images/small/image3.jpg" class="cloudzoom-gallery fancybox" data-cloudzoom="useZoom: '#zoom', image: 'images/small/image3.jpg', zoomImage: images/large/image3.jpg'" rel="seismicgallery">Image 3</a>

</div>


</body>

0 个答案:

没有答案