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

Sanju
5653 silver badges13 bronze badges
asked Mar 7, 2019 at 11:20
4
  • You can use any of the slider modules available in market Commented Mar 7, 2019 at 11:33
  • 1
    See this: magento.stackexchange.com/questions/259904/… Commented Mar 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 Commented Mar 7, 2019 at 11:41
  • just 'jquery' & 'owlcarousel' Commented Mar 12, 2019 at 12:40

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.