문제

I use the Mageplaza Owl Carousel. I haven't changed anything, but it doesn't always load, and I get a console error saying owlCarousel is not a function. Other times it loads as expected.

I've cleared all the caches and deployed all of the content multiple times, but it's still inconsistent. How can I get it to work normally?

This is the code

<script>
        require(['jquery', 'mageplaza/core/owl.carousel'], function ($) {
            $('#bannerslider-list-items-<?= /* @noEscape */ $sliderId ?>').owlCarousel(<?= /* @noEscape */ $sliderOptions ?>);
            if(/Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
                var widthMb = parseFloat($('.page-wrapper').width()) - 30;
                $('.mp-banner-sidebar').attr('style','max-width: '+widthMb+'px');
            }
        });
    </script>

And in the Mageplaza core module in the requirejs-config there's this entry

'mageplaza/core/owl.carousel': 'Mageplaza_Core/js/owl.carousel.min',

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top