Skip to content

Commit 9498f42

Browse files
committed
MC-5419: Background Attachment Fixed Does Not Work In Mobile Android or iPhone on Storefront
- fix parallax zero setting to background image fixed admin and storefront
1 parent 89d84c6 commit 9498f42

File tree

3 files changed

+7
-3
lines changed
  • app/code/Magento/PageBuilder/view

3 files changed

+7
-3
lines changed

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

Lines changed: 2 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/row/preview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default class Preview extends PreviewCollection {
4949
) {
5050
_.defer(() => {
5151
// Build Parallax on elements with the correct class
52+
const parallaxSpeed = Number.parseFloat(this.parent.dataStore.get("parallax_speed") as string);
5253
jarallax(
5354
this.element,
5455
{
@@ -58,7 +59,7 @@ export default class Preview extends PreviewCollection {
5859
(this.parent.dataStore.get("background_repeat") as "repeat" | "no-repeat") || "no-repeat"
5960
),
6061
imgSize: this.parent.dataStore.get("background_size") as string || "cover",
61-
speed: Number.parseFloat(this.parent.dataStore.get("parallax_speed") as string) || 0.5,
62+
speed: !isNaN(parallaxSpeed) ? parallaxSpeed : 0.5,
6263
},
6364
);
6465

app/code/Magento/PageBuilder/view/base/web/js/content-type/row/appearance/default/widget.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ define([
2222
$element.addClass('jarallax');
2323
$element.attr('data-jarallax', '');
2424

25+
var parallaxSpeed = parseFloat($element.data('parallaxSpeed'));
26+
2527
window.jarallax($element[0], {
2628
imgPosition: $element[0].style.backgroundPosition || '50% 50%',
2729
imgRepeat: $element[0].style.backgroundRepeat || 'no-repeat',
2830
imgSize: $element[0].style.backgroundSize || 'cover',
29-
speed: parseFloat($element.data('parallaxSpeed')) || 0.5
31+
speed: !isNaN(parallaxSpeed) ? parallaxSpeed : 0.5
3032
});
3133
};
3234
});

0 commit comments

Comments
 (0)