我正在尝试Elevate Zoom,但遇到了一个小问题,需要一些帮助。
基本上,正如您从我设置的演示中看到的那样,我试图找出当您单击缩略图或重置数据时是否有办法重新初始化插件,以便获得更高的图像(塔的照片),缩放窗口未使用第一张图像的尺寸。(我从我能发现它正在做的事情中收集到)
不幸的是,我没有能力让人们正确使用这种格式的图像,因此需要考虑各种高度的图像。可以做到吗?
我的代码,暂时基于演示文件
<img style="border:1px solid #e8e8e6;" id="zoom_03" src="http://www.elevateweb.co.uk/wp-content/themes/radial/zoom/images/small/image3.png"
data-zoom-image="http://www.elevateweb.co.uk/wp-content/themes/radial/zoom/images/large/image3.jpg"
width="411" />
<div id="gallery_01">
<a href="#" class="elevatezoom-gallery active" data-update="" data-image="images/large/image1.jpg" data-zoom-image="images/large/image1.jpg">
<img src="images/large/image1.jpg" width="100" />
</a>
<a href="#" class="elevatezoom-gallery" data-update="" data-image="images/large/image2.jpg" data-zoom-image="images/large/image2.jpg">
<img src="images/large/image2.jpg" width="100" />
</a>
<a href="#" class="elevatezoom-gallery" data-image="images/large/image3.jpg" data-zoom-image="images/large/image3.jpg">
<img src="images/large/image3.jpg" width="100" />
</a>
<a href="#" class="elevatezoom-gallery" data-update="" data-image="images/large/image1.jpg" data-zoom-image="images/large/image1.jpg">
<img src="images/large/image1.jpg" width="100" />
</a>
<a href="#" class="elevatezoom-gallery" data-update="" data-image="images/large/image5.jpg" data-zoom-image="images/large/image5.jpg">
<img src="images/large/image5.jpg" width="100" />
</a>
</div>
jQuery
$("#zoom_03").elevateZoom({gallery:'gallery_01', cursor: 'crosshair', galleryActiveClass: "active", zoomType: "inner" });
var image = $('#gallery_01 a');
var zoomConfig = { };
var zoomActive = false;
image.on('click', function(){
$.removeData(image, 'elevateZoom');//remove zoom instance from image
image.elevateZoom(zoomConfig);//initialise zoom
});
边注
您可能会注意到我已经将所有对图像的引用都指向了大文件路径,这是因为在我需要使用此插件的方式中,用户只会上传中等分辨率的文件。