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

STENCIL-3106 Switch from jquery-zoom to easyzoom #1096

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

christensenep
Copy link
Contributor

What?

Allow for lazy loading of the magnified "zoom" image on the product details page, by using the EasyZoom library instead of jquery-zoom.

Tickets / Documentation

@jasonherbst8
Copy link

lgtm 👍

this.setActiveThumb();
this.swapMainImage();
this.setImageZoom();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we still need to call setImageZoom. otherwise this.easyzoom will be undefined in swapMainImage, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we need to, as this zoom library works a bit differently than the old one. Now you just initialize it on an element (in this case the productView-image figure), and it manages swapping both the zoomed image and the normal-sized images. So the same easyzoom instance is actually sticking around as you swap images around.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i see - i completely missed that it's called from the init method.


destroyImageZoom() {
this.$mainImage.trigger('zoom.destroy');
this.easyzoom = $('.easyzoom').easyZoom({errorNotice: "", loadingNotice: ""});
Copy link
Contributor

@mjschock mjschock Oct 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm thinking we can scope the call to $('.easyzoom') here like this.$mainImage.$('.easyzoom') so it doesn't need to traverse the whole dom

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, there's actually no need for the .easyzoom class at all, so I just removed it entirely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@christensenep christensenep force-pushed the STENCIL-3106 branch 3 times, most recently from 69b01b5 to b14d867 Compare October 10, 2017 20:45
Copy link
Contributor

@mjschock mjschock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christensenep christensenep merged commit 9f2cf03 into bigcommerce:master Oct 11, 2017
@junedkazi
Copy link
Contributor

@BC-EChristensen this is missing a changelog entry. Can you please add it as part of #1097

@christensenep
Copy link
Contributor Author

Ack, sorry about that. Yes, will add it to #1097.

@bookernath
Copy link
Contributor

Thanks for this! Excited to see the improvements.

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

Successfully merging this pull request may close these issues.

None yet

5 participants