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

4

1 Answer 1

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>
4
  • Where to put require js file ? Mar 7, 2019 at 12:25
  • In vendor/module/view/frontend
    – user68317
    Mar 7, 2019 at 12:26
  • i want to do it using custom theme Mar 7, 2019 at 12:31
  • You can have a module along with the theme
    – Manish Joy
    Mar 7, 2019 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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