Skip to content

Commit 35e518d

Browse files
author
joiecaquicla
committed
magento2/magento2-page-builder#636: Responsive breakpoint switcher - fix for product content type carousel appearance
1 parent a35e560 commit 35e518d

File tree

2 files changed

+27
-1
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+27
-1
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/products/preview.js

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/products/preview.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ export default class Preview extends BasePreview {
7575
}
7676
}
7777
});
78+
79+
events.on(`stage:${this.contentType.stageId}:viewportChangeAfter`, (args: {viewport: string}) => {
80+
const viewports = Config.getConfig("breakpoints");
81+
this.slidesToShow = parseFloat(viewports[args.viewport].options.products.default.slidesToShow);
82+
this.destroySlider();
83+
this.initSlider();
84+
});
7885
}
7986

8087
/**
@@ -168,6 +175,10 @@ export default class Preview extends BasePreview {
168175
}
169176
}
170177

178+
protected destroySlider(): void {
179+
$(this.element.children).slick('unslick');
180+
}
181+
171182
/**
172183
* Build the slick config object
173184
*

0 commit comments

Comments
 (0)