Shopify themes, liquid, logos, and UX
Hey guys, I want to add an animation for expanding the answers in the collapsible content section.
I’ve already added an animation using this code, but it only works on desktop:
So I’d like to add a similar or even the same animation, but make it work on MOBILE.
Here’s the store where it works on mobile, and I’d like a similar animation: https://tomnoske.store/products/cinema-luts (Just scroll down, there’s the collapsible content)
And here’s the link to my store: https://1049xn-ya.myshopify.com/products/editing-masterclass
(Just scroll down, there’s the collapsible content)
I ONLY NEED THIS ON MOBILE; IT WORKS ON DESKTOP!
Thanks so much,
Tim
Hi @CreatorTim
I see it working the same with example site.
- Helpful? Like and Accept solution! Or Support me: Buy Me Coffee ❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Hey, so when I tested it in the Shopify editor's mobile view, it worked fine. But when I opened the store on an actual mobile device, it didn’t work.
To add animation you can use following CSS code to fix it
/* Default styles for collapsible content */
.accordion details::details-content {
display: block;
margin-inline: 2rem;
block-size: 0;
overflow: hidden;
transition-property: block-size, content-visibility;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
/* Expanded state */
.accordion details[open]::details-content {
block-size: auto;
}
/* Mobile-specific styles */
@media (max-width: 768px) {
.accordion details::details-content {
display: block;
margin-inline: 1rem; /* Adjust spacing for mobile */
block-size: 0;
overflow: hidden;
transition-property: max-height, padding;
transition-duration: 0.4s;
transition-timing-function: ease-in-out;
}
.accordion details[open]::details-content {
max-height: 300px; /* You can adjust this value based on the content size */
padding: 10px; /* Add padding for smoother animation */
}
}
Hey, your code isn’t working. It made it stop working not only on mobile but also on desktop.
Need to check code of theme then to fix it
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024