Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to remove remove the zoom from the specific image ? #130

Open
shivarajnaidu opened this issue Nov 29, 2021 · 2 comments
Open

Option to remove remove the zoom from the specific image ? #130

shivarajnaidu opened this issue Nov 29, 2021 · 2 comments

Comments

@shivarajnaidu
Copy link

How to remove the zoom for specific image when i want to ?

@ratulSharker
Copy link

ratulSharker commented May 6, 2022

I faced the similar issue, while working with a carousel / slider library with elevatezoom-plus.

Note that, elevatezoom-plus already support such feature (Colorbox Gallery Example), but i have to use it with Slick Slider.

My problem was, when i click / select separate image from the carousel, i have to show that selected image and hover effect on that image have to render that image with elevate zoom effect.

I have solved mine by following

// `img` is the image HTMLElement from which i want to remove elevate-zoom effect
$.removeData($(img), "ezPlus");
$('.zoomContainer').remove();

I know this implementation might not work for you because of following

  • If multiple image has elevate-zoom effect, it will remove all the elevate-zoom effect from the window, because there is no identifier, for which image that particular elevate-zoom effect is being shown.

Proper way would be maintaining an identifier (may be in data attribute in both img element and the zoomContainer to know, which zoomContainer to remove for which image).

I would be glad to give an PR implementing that, if the maintainers allows.

@larrynalzaro
Copy link

THE EASIEST solution is to edit the plugin itself.

  1. Add a new property, like so:

self.dom_index = self.$elem.data('zoom-index');

  1. Then go and locate the zoomContainer definition and modify it like so:
self.zoomContainer =
                $('<div class="zoomContainer zoomContainer-' + self.dom_index + '" style="' +
                    'position:absolute;' +
                    'left:' + self.nzOffset.left + 'px;' +
                    'top:' + self.nzOffset.top + 'px;' +
                    'height:' + self.nzHeight + 'px;' + '' +
                    'width:' + self.nzWidth + 'px;' +
                    'z-index:' + self.options.zIndex + '"></div>');
  1. Now you have a reference point for each zoomContainer.

w00t,
You are welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants