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): BCTHEME-297 Cornerstone 4.11.0 - Product Image Carousel Becomes Unresponsive on Product Page #1879

Merged
merged 2 commits into from
Oct 21, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Fixed Product Image Carousel Becomes Responsiveness on Product Page. [#1879](https://github.com/bigcommerce/cornerstone/pull/1879)
- Move phrases and static strings to en.json for improving translation customizing. [#1850](https://github.com/bigcommerce/cornerstone/pull/1850)
- Update carousel images to improve LCP indicator from Lighthouse performance report. [#1876](https://github.com/bigcommerce/cornerstone/pull/1876)
- Add aria label with price to Product Grid Item. [#1875](https://github.com/bigcommerce/cornerstone/pull/1875)
Expand Down
11 changes: 8 additions & 3 deletions assets/js/theme/common/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ export default function () {

if ($carouselCollection.length === 0) return;

$carouselCollection.on('init', onCarouselChange);
$carouselCollection.on('afterChange', onCarouselChange);

$carouselCollection.each((index, carousel) => {
// getting element using find to pass jest test
const $carousel = $(document).find(carousel);

if ($carousel.hasClass('productView-thumbnails')) {
$carousel.slick();
return;
}

$carousel.on('init', onCarouselChange);
$carousel.on('afterChange', onCarouselChange);

const isMultipleSlides = $carousel.children().length > 1;
const customPaging = isMultipleSlides
? () => (
Expand Down