igorlino / elevatezoom-plus

Enhanced elevateZoom - A jQuery image zoom plugin
http://igorlino.github.io/elevatezoom-plus/
MIT License
162 stars 78 forks source link

Setting Zoom Level causes issues #108

Open Airn5475 opened 6 years ago

Airn5475 commented 6 years ago

I started having issues with ez-plus in my app with the initial zoom of a picture being jacked up as compared to the zoom that happens after clicking on a gallery photo. Able to reproduce using the code found in the examples...which doesn't match the code displayed. (Please update your example code, many typos!)

I've narrowed it down to the zoomLevel setting. If I comment it out, everything seems to be fine, except for the fact that the zoom isn't at the level I want.

<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> 
<script type="text/javascript" src="https://cdn.rawgit.com/igorlino/elevatezoom-plus/1.1.17/src/jquery.ez-plus.js"></script>
</head>
<body>
    <img class="zoom-img" id="zoom_03" src="images/small/image1.jpg" data-zoom-image="images/large/image1.jpg" style="position: absolute; width: 414px; height: 274px;">
    <div id="gallery_01">
        <a href="#" data-image="images/small/image1.jpg" data-zoom-image="images/large/image1.jpg" class="active">
            <img src="images/thumb/image1.jpg"/>
        </a>
        <a href="#" data-image="images/small/image2.jpg" data-zoom-image="images/large/image2.jpg">
            <img src="images/thumb/image2.jpg"/>
        </a>
        <a href="#" data-image="images/small/image3.jpg" data-zoom-image="images/large/image3.jpg">
            <img src="images/thumb/image3.jpg"/>
        </a>
        <a href="#" data-image="images/small/image4.jpg" data-zoom-image="images/large/image4.jpg">
            <img src="images/thumb/image4.jpg"/>
        </a>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
                $("#zoom_03").ezPlus({
                        gallery: 'gallery_01',
                        cursor: 'crosshair',
                        galleryActiveClass: "active",
                        imageCrossfade: true,
                        zoomType: 'window',
                        zoomWindowWidth: 300,
                        zoomWindowHeight: 300,
                        zoomLevel: 3,
                        scrollZoom: true,
                responsive: true
                });

                $("#zoom_03").bind("click", function (e) {
                        var ez = $('#zoom_03').data('ezPlus');
            ez.closeAll(); //NEW: This function force hides the lens, tint and window
            //$.fancyboxPlus(ez.getGalleryList());
            return false;
                });
        });
    </script>
</body>
</html>