我从ElevateWeb获得了此代码。我尝试了该网络上的最后一种方法图像约束。但是,我试图复制它,但它仍然无法在我的结束。
首先,我的编码对于HTML
就像这样<img id="img_01" src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"
data-zoom-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"/>
<div id="gal1">
<a href="#" data-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"
data-zoom-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png">
<img id="img_01" src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png" /> </a>
<a href="#" data-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"
data-zoom-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png">
<img id="img_01" src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png" /> </a>
<a href="#" data-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"
data-zoom-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png">
<img id="img_01" src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png" /> </a>
<a href="#" data-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png"
data-zoom-image="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png">
<img id="img_01" src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/images/test.png" /> </a>
</div>
我写的这些脚本
<script type="text/javascript">
$("#zoom_03").elevateZoom({
constrainType:"height",
constrainSize:274,
zoomType: "lens",
containLensZoom: true,
gallery:'gallery_01',
cursor: 'pointer',
galleryActiveClass: "active"});
$("#zoom_03").bind("click", function(e) {
var ez = $('#zoom_03').data('elevateZoom');
$.fancybox(ez.getGalleryList());
return false;
});
</script>
我还打电话给jQuery Library:
<script src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/scripts/elevateZoom/jquery-1.8.3.min.js"></script>
<script src="http://<?php echo $_SERVER['HTTP_HOST'] ?>/assets/scripts/elevateZoom/jquery.elevatezoom.js"></script>
首先,图片正在网站上显示,但为什么我无法像ElevateWeb那样缩放图片?我错过了什么吗?