1

Anyone can help me out how to use owl carousel using a custom theme by using require js I have downloaded owl carousel zip file from an official website. I want to use this owl carousel in my block in admin I have created a custom theme and apply it in all stores using admin.make an owl carousel using custom theme

0

file : - requirejs-config.js

var config = {
    paths: {
        owlcarousel: 'Vendorname_Modulename/js/owl/owl.carousel',
    },
    shim: {
        owlcarousel: {
            deps: ['jquery']
        }
    }
};

.Phtml File need to define class name

<ol class="products list classname owl-carousel">

<script type="text/javascript">
require(['owlcarousel'], function () {
    jQuery(document).ready(function(){
        jQuery('.classname').owlCarousel({
            items:5,
            loop:true,
            dots:true,
            margin: 10,
            nav:true,
            autoplay:true,
            callbacks:false,
            responsive:{
                0:{
                   items:2, 
                },
                480:{
                    items:2,
                },
                768:{
                    items:3, 
                },
                1366:{
                    items:5, 
                }
            }
        })
    });
});
</script>
  • Where to put require js file ? – Harsh Jayswal Mar 7 at 12:25
  • In vendor/module/view/frontend – Mitrajsinh vaghela Mar 7 at 12:26
  • i want to do it using custom theme – Harsh Jayswal Mar 7 at 12:31
  • You can have a module along with the theme – Manish Joy Mar 7 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.