javascript - 如何禁用 elevateZoom?

标签 javascript jquery jquery-plugins

如何调用 elevateZoom 中的 destroy 函数? ?文档没有提及它,如果我在 source 中快速 ctrl+f ,我看到了 disable 的选项,但我不确定如何禁用或销毁 elevateZoom ?

我有以下代码:

HTML:

<img id="img_01" src="http://unilaboralgirona.com/wp-content/uploads/2015/03/ZContact.jpg" data-zoom-image="http://unilaboralgirona.com/wp-content/uploads/2015/03/ZContact.jpg"/> 

JS:

 $("img").elevateZoom({ zoomType    : "inner", cursor: "crosshair" , easing : true });

setTimeout(function(){}
      // how to destroy elevateZoom on image ? 
,2000); 

现在 3 秒后,我希望缩放功能不起作用(我这样做是为了隔离我的问题,现在请不要反问我为什么要这样做)。我在 setTimeout() 中做了什么导致 elevateZoom 无法正常工作。

FIDDLE HERE

最佳答案

因为 Elevate Zoom 没有原生的破坏,你必须做这样的事情:

setTimeout(function(){
      $.removeData($('img'), 'elevateZoom');
      $('.zoomContainer').remove();
},2000); 

这对我有用。希望这对您有所帮助!

关于javascript - 如何禁用 elevateZoom?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32047863/

相关文章:

javascript - 位置 href 返回为未定义

javascript - 动态加载angularjs并生成 Controller 和作用域

jquery - 在光滑的轮播上添加下一个上一个按钮

javascript - 是否可以删除最大调用堆栈大小?

javascript - HTML 图像翻转 : fade in to the left or right

javascript - 停止并重置 Harvest 的刻度计数器 jQuery 插件

javascript - 在 Html 文件中的值显示上设置单击事件,并希望在单击它时显示子元素

javascript - 如何在 ASP.Net 中的一个控件的两个 CSS 类之间切换?

javascript - jQuery UI 所见即所得?

jquery - 处理 CSS Shapes 和 IE Doctype