Infobahn
Infobahn

Reputation: 17

Elevate Zoom Plus: Unable to destroy instance

I'm using elevateZoom Plus on a site. I have a gallery of images and I'm trying to destroy my elevatezoom instance so I can change the main image and open a new one. The documentation isn't great, so I'm using this code, which I found in the answer to a GitHub issue:

plugin = $('.main-image').data('ezPlus');

if (plugin) {
    plugin.showHideZoomContainer(action);
    plugin.showHideWindow(action);
    plugin.showHideTint(action);
    plugin.showHideLens(action);
    plugin.destroy;
}

But I get the following error:

Uncaught TypeError: plugin.destroy is not a function. So I'm guessing that the destroy() method isn't the right way to go about it, but all the info I've found says that's what to use.

Upvotes: 0

Views: 881

Answers (1)

Thant
Thant

Reputation: 1

Try this one:

let action='hide';    
let plugin = $('.main-image').data('ezPlus');

if (plugin) {
    plugin.showHideZoomContainer(action);
    plugin.showHideWindow(action);
    plugin.showHideTint(action);
    plugin.showHideLens(action);
    plugin.destroy();
}

Upvotes: 0

Related Questions