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
-
You can use any of the slider modules available in market– Manish JoyMar 7, 2019 at 11:33
-
1See this: magento.stackexchange.com/questions/259904/…– Shoaib MunirMar 7, 2019 at 11:34
-
@ManishJoy I dont know which css and js files should be there in custom theme and call them in my block using require js– Harsh JayswalMar 7, 2019 at 11:41
-
just 'jquery' & 'owlcarousel'– Manish JoyMar 12, 2019 at 12:40
1 Answer
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>
-
-
In
vendor/module/view/frontend
– user68317Mar 7, 2019 at 12:26 -
-