jQuery gzoom plugin doesn't work

烂漫一生 提交于 2019-12-07 04:19:06

问题


I am trying to add a zoom on my image with the jQuery (brilliant) plugin gzoom (http://lab.gianiaz.com/jquery/gzoom/ or http://www.chouselive.co.za/demo/pictures/zoom/gzoom.php).

But it doesn't work. My image is just resized, but there is no zoom in it.

Here is my code :

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>test gzoom</title>
  <link rel="stylesheet" href="css/jquery-ui-1.7.1.custom.css" type="text/css" media="screen">
  <link rel="stylesheet" href="css/jquery.gzoom.css" type="text/css" media="screen">
  <style>
    div#zoom{
      cursor: crosshair;
    }
  </style>
</head>
<body>
    <div id="gzoomwrap">
        <div id="zoom" class="zoom minizoompan">
            <span class="loader">loading...</span>
            <img src='img/myImage.png'/>
        </div>
        <!-- START gzoom zoom bar -->
        <div class="ui-icon ui-icon-circle-minus gzoombutton">&nbsp;</div>
        <div class="gzoomSlider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" style="width: 258px;"><a href="#" class="ui-slider-handle ui-state-default ui-corner-all"></a></div>
        <div class="ui-icon ui-icon-circle-plus gzoombutton">&nbsp;</div>
        <br style="clear:both">
        <!-- END gzoom zoom bar -->
    </div>

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <!-- START gzoom dependencies -->
    <script type="text/javascript" src="js/ui.core.min.js"></script>
    <script type="text/javascript" src="js/ui.slider.min.js"></script>
    <script type="text/javascript" src="js/jquery.gzoom.js"></script>
    <script type="text/javascript" src="js/jquery.mousewheel.js"></script>
    <script type="text/javascript">
      /*<![CDATA[*/
      $(function() {
        $zoom = $("#zoom").gzoom({
            sW: 300,
            sH: 225,
            lW: 1400,
            lH: 1050,
            lighbox : false
        });
      });
      /*]]>*/
    </script>
    <!-- END gzoom dependencies -->
</body>
</html>

I looked on the Chrome console, and found some errors in the libraries. So I assume I didn't implement gzoom correctly. (Doesn't work in all browsers)

If you know what I'm doing wrong... I'll thank you a lot !


回答1:


I'm the gzoom plugin author. The plugin was developed a lot of time ago, but it's still working with new versions of jquery and jquery ui. If you include a modern jquery version you have also to include a modern version of jquery-ui. I've just tried the plugin with this versions and it does his job:

jquery-1.10.2.min.js jquery-ui-1.10.3.custom.min.js

Include this files, and remove the ui.core.min from, and ui.slider.min.



来源:https://stackoverflow.com/questions/19659646/jquery-gzoom-plugin-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!