简体   繁体   English

删除或取消绑定功能?

[英]remove or unbind function on click?

I have a image zoom function. 我有图像缩放功能。 I basically want to be able to click zoom on and zoom off, which will enable zoom or disable zoom function. 我基本上希望能够单击“放大”和“缩小”,这将启用缩放或禁用缩放功能。

I have it working if I click zoom on, But I cannot work out how to remove the function. 如果单击“放大”,它可以正常工作,但是无法确定如何删除该功能。

To destroy or taking-off zooming effect from any image you can use following code apparently if that helps. 要破坏或消除任何图像的缩放效果,显然可以使用以下代码(如果有帮助)。

$("img").image_zoomer("destroy");

This fiddle will explain better. 这个小提琴会更好地解释。

https://jsfiddle.net/u5bn9dwr/3/ https://jsfiddle.net/u5bn9dwr/3/

Thanks! 谢谢!

You can simply use unbind() method as $("img").unbind(); 您可以简单地将unbind()方法用作$("img").unbind(); To see: http://www.w3schools.com/jquery/event_unbind.asp 查看: http : //www.w3schools.com/jquery/event_unbind.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM