diff --git a/CHANGELOG.md b/CHANGELOG.md index e034dbbff5..8db82c1f06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Product images in quick view can be squashed. [#2075](https://github.com/bigcommerce/cornerstone/pull/2075) - Fixed shift in change options popup on Cart page.[#2071](https://github.com/bigcommerce/cornerstone/pull/2071) - Fixed possibility to select 'None' on multi unrequired Swatch Options. [#2068](https://github.com/bigcommerce/cornerstone/pull/2068) - Translation Gap: Account -> Wish List -> Name required message. [#2060](https://github.com/bigcommerce/cornerstone/pull/2060) diff --git a/assets/js/theme/global/quick-view.js b/assets/js/theme/global/quick-view.js index d4ab963755..90fd2005ea 100644 --- a/assets/js/theme/global/quick-view.js +++ b/assets/js/theme/global/quick-view.js @@ -2,7 +2,7 @@ import 'foundation-sites/js/foundation/foundation'; import 'foundation-sites/js/foundation/foundation.dropdown'; import utils from '@bigcommerce/stencil-utils'; import ProductDetails from '../common/product-details'; -import { defaultModal } from './modal'; +import { defaultModal, ModalEvents } from './modal'; import 'slick-carousel'; import { setCarouselState, onSlickCarouselChange, onUserCarouselChange } from '../common/carousel'; @@ -17,12 +17,13 @@ export default function (context) { modal.open({ size: 'large' }); utils.api.product.getById(productId, { template: 'products/quick-view' }, (err, response) => { + if (err) return; + modal.updateContent(response); modal.$content.find('.productView').addClass('productView--quickView'); const $carousel = modal.$content.find('[data-slick]'); - if ($carousel.length) { $carousel.on('init breakpoint swipe', setCarouselState); $carousel.on('click', '.slick-arrow, .slick-dots', setCarouselState); @@ -31,7 +32,13 @@ export default function (context) { $carousel.on('click', '.slick-arrow, .slick-dots', $carousel, e => onUserCarouselChange(e, context)); $carousel.on('swipe', (e, carouselObj) => onUserCarouselChange(e, context, carouselObj.$slider)); - $carousel.slick(); + if (modal.$modal.hasClass('open')) { + $carousel.slick(); + } else { + modal.$modal.one(ModalEvents.opened, () => { + if ($.contains(document, $carousel[0])) $carousel.slick(); + }); + } } return new ProductDetails(modal.$content.find('.quickView'), context); diff --git a/assets/scss/components/stencil/productView/_productView.scss b/assets/scss/components/stencil/productView/_productView.scss index 6893bb30be..36cd299b61 100644 --- a/assets/scss/components/stencil/productView/_productView.scss +++ b/assets/scss/components/stencil/productView/_productView.scss @@ -64,6 +64,14 @@ margin-left: -(spacing("quarter")); margin-right: -(spacing("quarter")); + &[data-slick] { + opacity: 0; + + &.slick-initialized { + opacity: 1; + } + } + .slick-list { margin-left: remCalc(40px); margin-right: remCalc(40px);