Today we are going to see how can we make carousel in Divi which I think is an important and missing module in Divi but it’s competitors like Elementor and Beaver Builder have. So why we left behind. Let’s do this and convert any number of modules into series of the carousel.
Step 1:
As always step 1 is making environment. I always assume starting point as Divi default settings. Navigate to Divi > Theme Options > Integration > Head Section and paste following code. Please remember, if code will not work after pasting then remove and retype commas and arrows as sometime while copy pasting code commas and arrows are change.
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css"/> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script> jQuery(document).ready(function($) { $('.single-item').slick({ slidesToShow: 3, slidesToScroll: 1, autoplay: true, autoplaySpeed: 2000, responsive: [ { breakpoint: 968, settings: { slidesToShow: 2 } }, { breakpoint: 680, settings: { slidesToShow: 1 } } ] }); });
After copying jQuery library and script now it’s time to copy CSS to give some default styling to our carousel. For CSS please copy following code and paste it in Divi > Theme Options > Custom CSS like we show in figure 1.3
.single-item .et_pb_module { padding:20px !important; margin:0px 10px !important; border: 1px solid #eee; } .slick-prev, .slick-next { display: inline-block; width: 20px; height: 20px; font-size: 0; font-weight: 400; font-style: normal; font-family: dashicons; line-height: 1; text-align: center; text-decoration: inherit; position: absolute; top:46%; cursor: pointer; border: none; outline: none; padding: 0; vertical-align: top; z-index: 9; color: transparent; background: transparent; -webkit-transition: color .1s ease-in 0; transition: color .1s ease-in 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .slick-prev { left: -40px; } .slick-next { right: -20px; } .slick-prev:before { color: #000; font-size: 35px; content: "\\f341"; } .slick-next:before { color: #000; font-size: 35px; content: "\\f345"; }
Step 2:
Now since we have the environment ready so we can jump on actual work that we need to do. Okay now go to post or page where you want the carousel to be created and give a row column a class name “single-item” (obviously without inverted commas) like we mentioned in figure 1.4 and 1.5
After inserting class in a row now you are ready to insert as many modules as you want they will appear as a carousel on the front end. I have shown in figure 1.6 that I have inserted in a demo version.
That’s it! You have created a carousel of any module. I know what you guys are thinking now 😉 that where is blog module!! Right? Yes, blog module will not work in this way since it has some different hierarchy so I will make a different tutorial for that. Till then have a good day and thanks for read my tutorials. Do comment and share url in a comment below if you use this method in your project.
As an extremely handy aside, if you add .slick-list { overflow: visible;} it becomes even more intuitive on mobile that it’s a swipe-able list of options.
yes that can be helpful, but if you want to hide arrows only then you can insert
arrows: false,
in jQuery script under breakpoint. Like;
{
breakpoint: 680,
settings: { slidesToShow: 1, arrows:false }
}
Is it possible to make this functionality work only on mobile?
no idea about that 🙂
You can use Divi default show/hide feature available under the advanced option of each module or row or section.
Hey there, I think this is broken; did the Divi updates change that?
Hi, thanks for pointing out. Link is fixed now.
Hi, how to remove border around module in slider?
Hi Senad, Sorry for late reply. Border is not part of this script, so must be appearing through Divi module default CSS. So check your module design settings and set border to zero. If this doesn’t help then send me your website url through contact form. I will reply back with a solution ASAP.
It is part of the CSS:
.single-item .et_pb_module {
padding:20px !important;
margin:0px 10px !important;
border: 1px solid #eee;
replace border with border-style: none;