Like our free content? Then you'll love our exclusive Club!
Divi Academy Membership gives you exclusive access to over 110 resources, including child themes, layouts, cheatsheets, tutorials, live training and member perks. And new content is added EVERY Monday!
Update – 29/09/2017: After recent Divi updates this is no longer working so well. As this recipe was originally experimental and a bit of fun I will not be updating it so please use at your own risk, you will need a decent level of CSS knowledge to get this working with Divi 3.0.76+.
Recipe #9 takes an accordion image slider I found on Tympanus.net (can you tell I am a little obsessed with that site?
) and turns it into a cool responsive menu you can use to link to galleries, portfolios, projects or even blog categories. This would be a great feature for photography or portfolio websites but with a little imagination, you could use it for pretty much anything
Click here to see the live demo and download the xml file

So let’s get cooking!
Ingredients
The Divi Theme or Divi Builder Plugin from Elegant Themes
6 suitable images (mine are 500x750px)
Cooking time
This should take you around 15 – 20 minutes max.
Preparation
The first thing we need to do is create our module. We are going to use the code module for this effect as it won’t strip out the custom code we are adding like a text module sometimes does.
Create a new section with one column and add a code module.
Click on the Custom CSS tab and give the code module a custom css class of ds-container .

Method
Next, whilst still in the code module, click on the General Setting tab and paste in the following HTML into the Content area. Be sure to paste it in as it is, don’t try to add line spacing to make it look nicer as this will break the effect. You will need to replace the link URLs, captions, image URLs and alt text with your own images and text. Then save & exit.
<figure><img src="https://divisoup.com/wp-content/uploads/2016/03/children.jpg" alt="Children"><input type="radio" name="radio-set" checked="checked"><figcaption><a href="#"><span>Children</span></a></figcaption><figure><img src="https://divisoup.com/wp-content/uploads/2016/03/newborn.jpg" alt="Newborn"><input type="radio" name="radio-set"><figcaption><a href="#"><span>Newborn</span></a></figcaption><figure><img src="https://divisoup.com/wp-content/uploads/2016/03/pets.jpg" alt="Pets"><input type="radio" name="radio-set"><figcaption><a href="#"><span>Pets</span></a></figcaption><figure><img src="https://divisoup.com/wp-content/uploads/2016/03/weddings.jpg" alt="Weddings"><input type="radio" name="radio-set"><figcaption><a href="#"><span>Weddings</span></a></figcaption><figure><img src="https://divisoup.com/wp-content/uploads/2016/03/fashion.jpg" alt="Fashion"><input type="radio" name="radio-set"><figcaption><a href="#"><span>Fashion</span></a></figcaption><figure><img src="https://divisoup.com/wp-content/uploads/2016/03/food.jpg" alt="Food"><input type="radio" name="radio-set"><figcaption><a href="#"><span>Food</span></a></figcaption></figure></figure></figure></figure></figure></figure></figure>

Now for the CSS, copy and paste the code below into your Child Theme style.css or if you aren’t using a child theme (which you really should be) then paste into the Divi Theme Options epanel custom CSS section and don’t forget to save.
/*---------- [Accordion Image Slider Menu] ----------*/
.ds-container {
width: 1000px;
margin: 20px auto;
overflow: hidden;
box-shadow: 1px 1px 4px rgba(0,0,0,0.5);
border: 1px solid rgba(255,255,255,1);
}
.ds-container figure {
position: absolute;
top: 0 !important;
left: 100px; /* width of visible piece */
margin: 0;
width: 500px;
box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
transition: all 0.3s ease-in-out;
}
.ds-container > figure {
position: relative;
left: 0 !important;
}
.ds-container img {
display: block;
width: 100%;
}
.ds-container input {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100%;
cursor: pointer;
border: 0;
padding: 0;
opacity: 0;
z-index: 100;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.ds-container input:checked{
width: 5px;
left: auto;
right: 0px;
}
.ds-container input:checked ~ figure {
left: 500px;
transition: all 0.7s ease-in-out;
}
.ds-container figcaption {
width: 100%;
height: 100%;
background: rgba(87, 73, 81, 0.1);
position: absolute;
top: 0px;
transition: all 0.2s linear;
}
.ds-container figcaption span {
position: absolute;
top: 80%;
margin-top: -30px;
right: 20px;
left: 20px;
overflow: hidden;
text-align: center;
background: rgba(87, 73, 81, 0.3);
border: 1px solid #fff;
line-height: 20px;
font-size: 20px;
opacity: 0;
text-transform: uppercase;
letter-spacing: 8px;
font-weight: 800;
padding: 30px;
color: #fff;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}
.ds-container figcaption span:hover {
background: rgba(255, 255, 255, 0.3);
color: #000;
border: 1px solid #000;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}
.ds-container input:checked + figcaption,
.ds-container input:checked:hover + figcaption{
background: rgba(87, 73, 81, 0);
}
.ds-container input:checked + figcaption span {
transition: all 0.4s ease-in-out 0.5s;
opacity: 1;
top: 88%; /*placement of title link*/
}
.ds-container #ds-selector-last:checked + figcaption span {
transition-delay: 0.3s;
}
.ds-container input:hover + figcaption {
background: rgba(87, 73, 81, 0.03);
}
.ds-container input:checked ~ figure input{
z-index: 1;
}
@media screen and (max-width: 1024px) {
.ds-container {
width: 740px;
}
.ds-container figure {
left: 80px;
width: 340px;
}
.ds-container input {
width: 80px;
}
.ds-container input:checked ~ figure {
left: 340px;
}
.ds-container figcaption span {
font-size: 18px;
}
.ds-container input:checked + figcaption span {
top: 82%; /*placement of title link*/
}
}
@media screen and (max-width: 768px) {
.ds-container {
width: 540px;
}
.ds-container figure {
left: 50px;
width: 290px;
}
.ds-container input {
width: 50px;
}
.ds-container input:checked ~ figure {
left: 290px;
}
.ds-container figcaption span {
font-size: 16px;
}
.ds-container input:checked + figcaption span {
top: 80%; /*placement of title link*/
}
}
@media screen and (max-width: 520px) {
.ds-container {
width: 300px;
}
.ds-container figure {
left: 30px;
width: 150px;
}
.ds-container input {
width: 30px;
}
.ds-container input:checked ~ figure {
left: 150px;
}
.ds-container figcaption span {
font-size: 12px;
letter-spacing: 2px;
padding: 10px;
margin-top: -20px;
}
.ds-container input:checked + figcaption span {
top: 77%; /*placement of title link*/
}
}
@media screen and (max-width: 320px) {
.ds-container {
width: 260px;
}
.ds-container figure {
left: 26px;
width: 130px;
}
.ds-container input {
width: 26px;
}
.ds-container input:checked ~ figure {
left: 130px;
}
.ds-container figcaption span {
font-size: 10px;
letter-spacing: 2px;
padding: 10px;
margin-top: -20px;
}
.ds-container input:checked + figcaption span {
top: 77%; /*placement of title link*/
}
}
This CSS allows for 6 images/links but you can easily adjust it if you need more or less. Here’s how to do it:
The width is calculated like this: Number of images, minus 1, multiplied by the visible area you want to show, plus the width of the image.
So in my example it is calculated like this: ((6 – 1) * 100) + 500 = 1000. So 5 images (we ignore the first one as it shows by default) each having a 100px wide visible and clickable area with the active image being 500px wide.
The media queries use the same calculation but with smaller values based on the screen size.
And that’s it. Now you have a cool accordion image slider menu for use in your Divi projects.
If you found this helpful please leave a comment and subscribe to my newsletter for all my latest Divi related content. ![]()
Michelle X





Please, how would it be possible to put several different accordions on the same page?
Thank you very much.
You just need to duplicate the section and edit the links in the module
Please, could you tell me what values I have to change if I reduce the images to half their size?
You need to change the width value in this section of CSS
.ds-container figure {
position: absolute;
top: 0 !important;
left: 100px; /* width of visible piece */
margin: 0;
width: 500px;
box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
transition: all 0.3s ease-in-out;
}
thank you very much, I already got it. I just want to put more ACCORDION IMAGE SLIDER MENU units.
but I do not know how to put several different ones on the web.
Hey, the lastest divi update (sept 14 2017) seems to break this completely. They’ve added width and other options for every module so i guess that might be causing this. Please let me know if its possible to update this code and make it compatible with the new update.
Can you provide a link so I can take a look. I won’t be updating this tutorial as it was really experimental but happy to see if I can fix your issue for you.
Thank you for the quick reply. Here is the link I made with just this module enabled. It used to work before the last Divi update just fine. It renders like a line on every website of mine that was using this code, instantly after the Divi update.
I was using 2 of those modules on this website without any issues so far (since 1yr almost).
Its the overflow property that is causing the issue for some reason;
.ds-container {
overflow: hidden;
}
If you remove it you will see the modules, but you will also have to do some tweaking with those new width settings I think.
Removed That, now its being overlapped by other sections on the page. I did update the page in case you feel like checking it. Thanks.
I get no results found on that link
Yeah. Sorry, deleted that page while I was redesigning some elements of the site. Anyway don’t need the fix anymore, I’ve switched to that tabs module (made by you only) for some sites and normal animated blurbs for others. Think they both work better than this one on phones. Thank you so much for your time and helpfulness anyway
Really appreciate it.
Hi. Thank you very much for your work.
Please, I would appreciate to know how you can establish which image is left open by default.
Thank you very much.
With this particular layout you would need to make sure the first container on the left is the image you want to be open by default.
He does strange things. Depending on the html sometimes the middle or last one is open, so I asked how the order works.
Thank you.
Ah I see. Well if it is set up correctly, it should always be the first (left most) image that is open by default
that is the answer that establishes the open image by default. Thank you very much.
Yes! Sorry I misunderstood your question
checked=”checked”
http://www.globo-vision.com/adecaza/?page_id=25325
Hi Michelle,
I tryed to download the xml for your super accordion menu, but I get a 404 error. Is there any other way to download it ?
Sorry about that, slight error in the url, I have fixed it now
Thank you for this! Just having one issue since I updated to the last version of DIVI. It’s forcing me to now add a height to the ds-container css. I copied your code from scratch again and it worked fine but when I came back this morning the entire thing is not showing up on my site again. So really not sure what is happening. Have you experience this since the update?
This is a WP/Divi bug with stripping tags, you can check out this post and see if it helps. https://elegantmarketplace.com/help-my-paragraphs-and-line-breaks-keep-disappearing-from-the-divi-text-module/
Hey Michelle,
Love this design, if only there was away of making it auto adjust to the figures based on the screen size. I attempted making the container width max with the section set to full-width and gutter set to 1, but then adjusting the figure width is a pain, and when you adjust it to different screen sizes, it doesn’t follow unfortunately.
Obviously perfect for sitting in the site, but not possible as a full-width module.
Not currently no I am afraid, some of the CSS tricks in this require absolute values so its a little tricky
Michelle,
Thanks for the tutorial, it is amazing and worked great. I have a client that is looking for a fullwidth accordion just like you have. I have tried to make the module fullwidth and gutter at 1, but it aligns all the images to the left. I am building the site on a sample domain of mine at http://www.geauxlocal365.com
Any help is much appreciated!
Clay Young
Clay you will also need to adjust the size of the images in the CSS, they are set to fill the width at the moment and you just increased the width so the images need adjusting also.
Thank you very much for that! Im trying to achieve something similar but horizontally. Have a full with section about 500px in height with some centred text and a background image. Have maybe five of these sections. All stacked on top of each other. But when you click on one section, it expands out and reveals more full width images, then when you click on the other, it closes the previous and expands the new one. I think this is similar to what the accordion does, but styled to be full width and have tabs closed and with a background… Read more »
It would take a complete rewrite for this to work horizontally, but the way to go as you mention is with the accordion module, you can style it any way you want with enough CSS. Take a look at this post to see what I was able to do with the tabs module https://divisoup.com/how-to-use-the-tabs-module-for-content-navigation/
Michelle love your videos and your voice.
Looking at doing your course when its next available.
Michelle would it be possible to produce a tutorial on your menu please?
Thanking you
Thanks Aftab
My menu on Divi Soup? It is just using the inline centered logo option in the customiser and then you can add subtitles with this recipe https://divisoup.com/adding-subtitles-to-the-primary-menu/
I’m quite new to the world of Divi and the amazing things you can do with CSS and webkits… thus I cannot seem to figure this out. Instead of the text boxes appearing after selecting, does anyone know how to make them be present on each image then disappear after selecting?
Dear Michelle.. Can I buy you a coffee… and can you help me to make for 9 images and adjust the css as well… I don’t mind to try on my own, but I will likely not make it at the css side…
Here’s my attempt.. with 3 extra images..
Can’t seem to get it to work..
I think I did itttttttt… can you seeeeeeeee…
There you go Andrew, you don’t know what you can achieve until you try. Well done!
Yes you are right!! thank you very much Michelle! Looking forward to more recipes from you!! Keep up the good work! Would still love to buy you a coffee!!
Hi, Michelle.
Excelent Tutorial.
I was wondering it is possible too add a filter element -like in the portfolio grid module- to the accordion module and show some elements by categories..
I haven’t ever tried that Nicolas but I guess it would be possible with PHP, which unfortunately is not my forte
WOW from us too!
Michelle thank you for sharing.
Igor
Thanks Igor
Thank you for this! I’m wondering if it’d be possible to flip the text button of the headers so that they sit vertically and fill the space of the photos that is always seen as you scroll through (looks like far left). So that instead of piece of photos you’d see, read vertically, things like “events”, “pets”, “wedding” etc?
Or is there a code we can add to this recipe to make that an option?
Thanks
Hi Lisa
Yes this is very doable with CSS I just haven’t got around to updating that one yet, hopefully soon though
Really enjoyed this post, how can I make is so that I receive an update sent in an email when you publish a fresh post?
Hi Augustine, just use any of the signup forms on my site and you will get an email each time I release a new recipe
This is very attractive and something I had imagined and begun to work on so thank you very much, Michelle.
Welcome Gary
Michelle,
This is so great thank you.
One thing I am struggling with is the image size though. Having it working perfectly with your images, but as soon as I had my images I end up with sizing problems. Can I ask how you managed to get all the images to the same size?
Kind regards,
Andrew.
Hi Andrew, you need to make sure you images are all the same size to begin with and if you use image sizes which are a different aspect ratio to the demo/recipe you may need to tweak the CSS
Very cool! Any suggestions as to how to change the slide titles so they’re vertical and appear in the accordion unfolded – ie so you could see all of the titles before clicking?
Hi Sharon
Yes this should be achievable with CSS transforms and the correct positioning, you can try here for starters http://www.w3schools.com/cssref/css3_pr_transform.asp
Best of luck
HI Michelle,
It looks great and useful, just one question I would try myself but if you tried this my question is how to make it fullwidth to cover all width of the screen ?
thanks in advance keep the good work
Hi there
No I haven’t tried it fullwidth but as it is it wouldn’t work without a lot more media queries as the values are set in pixels. You could try changing to percentages and see if you can achieve it that way. Best of luck
I was looking on a similar effect on another theme to update my site, but they “didn’t offer customization” .
Here there is ; and it’s fantastic…
thanks a lot for all your recipes !
Thanks Claude! Glad it is helpful to you
Michelleeeeeeeeeeeeeeeeeeeee!!! You’re too awesome.. I’m lost for words… :'(
I love this, thinking of using it on a photography website we are getting ready to start. Thanks for sharing your recipes. These are Awesome!
Thanks Lori and my pleasure
Looks so amazingly beautiful ! I am lovin it !
Thanks Purnendu
I just Loooove your delicious recipes, Michelle. Thank you for this one. It’s a masterpiece.
Thank you Pablo, I can’t take all the credit though
it’s awesome, Thank You!
Divi for4ever
Welcome
Amazing!
Thanks
Thank you Michelle, it’s always a pleasure to see and follow your great tips.
Thanks Catherine
Super nice work!
Thanks Stefan
Thanks for this Michelle. As a web designer myself I always seem to be up to my neck in working on websites (Im not complaining mind you) but, I never seem to get time to experiment with new things and techniques. Your tips and workarounds have saved me a lot of time and added greatly to my arsenal
Thank you for that 
And thank you again Chris
Wow, this is impressive! Thank you Michelle!
Thanks Eileen!