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

fix(storefront):fix product Images don't change on click in IE11 #1748

Merged
merged 3 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Draft
- Fixed product image doesn't change on click when viewing a product with multiple images in IE11 [#1748](https://github.com/bigcommerce/cornerstone/pull/1748)
- Fixed alt text on image change in product view [#1747](https://github.com/bigcommerce/cornerstone/pull/1747)
- Added tooltip for modal close buttons. [#1773](https://github.com/bigcommerce/cornerstone/pull/1773)
- Carousel links should have discernible text. [#1789](https://github.com/bigcommerce/cornerstone/pull/1789)
- Add labels to swatches. [#1761](https://github.com/bigcommerce/cornerstone/pull/1761)
Expand Down
14 changes: 14 additions & 0 deletions assets/js/theme/product/image-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export default class ImageGallery {
}

swapMainImage() {
const isBrowserIE = navigator.userAgent.includes('Trident');

this.easyzoom.data('easyZoom').swap(
this.currentImage.mainImageUrl,
this.currentImage.zoomImageUrl,
Expand All @@ -74,6 +76,18 @@ export default class ImageGallery {
alt: this.currentImage.mainImageAlt,
title: this.currentImage.mainImageAlt,
});

if (isBrowserIE) {
const fallbackStylesIE = {
'background-image': `url(${this.currentImage.mainImageUrl}&ampimbypass=on)`,
'background-position': 'center',
'background-repeat': 'no-repeat',
'background-origin': 'content-box',
'background-size': 'contain',
};

this.$mainImageNested.css(fallbackStylesIE);
BC-tymurbiedukhin marked this conversation as resolved.
Show resolved Hide resolved
}
}

checkImage() {
Expand Down