diff --git a/app/code/Magento/PageBuilder/view/base/web/js/widget/video-background.js b/app/code/Magento/PageBuilder/view/base/web/js/widget/video-background.js index d918ab8f6c9..ed19c4bd354 100644 --- a/app/code/Magento/PageBuilder/view/base/web/js/widget/video-background.js +++ b/app/code/Magento/PageBuilder/view/base/web/js/widget/video-background.js @@ -3,10 +3,7 @@ * See COPYING.txt for license details. */ define([ - 'jquery', - 'jarallax', - 'jarallaxVideo', - 'vimeoWrapper' + 'jquery' ], function ($) { 'use strict'; @@ -18,23 +15,25 @@ define([ return; } - $element.addClass('jarallax'); - $element.attr('data-jarallax', ''); + require(['jarallax-wrapper', 'jarallaxVideo', 'vimeoWrapper'], function () { + $element.addClass('jarallax'); + $element.attr('data-jarallax', ''); - window.jarallax($element[0], { - imgSrc: $element.data('videoFallbackSrc'), - speed: !isNaN(parallaxSpeed) ? parallaxSpeed : 0.5, - videoLoop: $element.data('videoLoop'), - videoPlayOnlyVisible: $element.data('videoPlayOnlyVisible'), - videoLazyLoading: $element.data('videoLazyLoad'), - disableVideo: false, - elementInViewport: $element.data('elementInViewport') && - $element[0].querySelector($element.data('elementInViewport')) - }); - $element[0].jarallax.video && $element[0].jarallax.video.on('started', function () { - if ($element[0].jarallax.$video) { - $element[0].jarallax.$video.style.visibility = 'visible'; - } + window.jarallax($element[0], { + imgSrc: $element.data('videoFallbackSrc'), + speed: !isNaN(parallaxSpeed) ? parallaxSpeed : 0.5, + videoLoop: $element.data('videoLoop'), + videoPlayOnlyVisible: $element.data('videoPlayOnlyVisible'), + videoLazyLoading: $element.data('videoLazyLoad'), + disableVideo: false, + elementInViewport: $element.data('elementInViewport') && + $element[0].querySelector($element.data('elementInViewport')) + }); + $element[0].jarallax.video && $element[0].jarallax.video.on('started', function () { + if ($element[0].jarallax.$video) { + $element[0].jarallax.$video.style.visibility = 'visible'; + } + }); }); }; });