Shopify themes, liquid, logos, and UX
Hi, does anyone know how to add a smooth animation for sliding up the response in collapsible content on MOBILE?
I have already added the animation, but it works only on desktop, so how can I add a similar one for mobile?
Here is my store: https://1049xn-ya.myshopify.com/products/editing-masterclass
(Just scroll all the way down, that’s where the collapsible content is.)
And here is a store where it works even on mobile: https://tomnoske.store/products/cinema-luts
(Just scroll all the way down, that’s where the collapsible content is.)
As I said, I need it only on mobile!
Thanks a lot,
Tim
Hi @CreatorTim,
I am from Mageplaza - Shopify solution expert.
I have researched the two websites you provided. The difference between the animations lies in the transitions for the inner content. You can enhance this by adding custom CSS rules.
details .accordion__content {
will-change: transform;
transform: translateY(25px);
transition: transform .5s ease;
}
details[open] .accordion__content{
transform: translateY(0);
}
Please leave a comment if it functions as you expected. 🙂
Mageplaza | Top-Rated Shopify Agency | Trusted by 230,000+ worldwide merchants
If our suggestion works for you, please give it a Like or mark it as a Solution!
Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com
Hey, thanks for the feedback, it looks good, but it only works on desktop. I want it to work on mobile too—how can I do that?
Here's the full code for the collapsible content:
Thanks a lot,
Tim
Hi, Tim
I cannot determine the difference in transition between the desktop and mobile viewports. You can refer to this video for reference.
I also reviewed your CSS file, and the animation rules are not enclosed within a @media tag, which means they apply to all viewports. Am I misunderstanding your explanation? Could you please clarify what is functioning on the desktop viewport but not on mobile?
Best regards.
Mageplaza | Top-Rated Shopify Agency | Trusted by 230,000+ worldwide merchants
If our suggestion works for you, please give it a Like or mark it as a Solution!
Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com
Hey, I know what you mean. When you view the store with mobile dimensions on a desktop, the animation works, but when you open the store on an actual mobile device, the animation doesn’t work.
I also noticed that the animation works when I use the mobile preview in Shopify's editor, but it just doesn’t work on a real mobile device.
Check it out on a real mobile device, and you’ll see it’s not working.
Hi @CreatorTim,
I understand your point. Based on my research, the issue might be caused by inappropriate CSS rules for mobile devices. I checked on both iOS and Android devices, and none of them worked. However, I couldn't identify the CSS rule that controls the expand/collapse behavior for the card (there seems to be no transition for .accordion; it might be controlled by JavaScript?). Here's an updated transition for the inner content:
details[open] .accordion__content {
transform: translateY(0);
opacity: 1; /* Ensure smooth visibility */
}
details .accordion__content {
will-change: transform, opacity; /* Optimize for mobile hardware acceleration */
transform: translateY(25px);
opacity: 0; /* Start with hidden content */
transition: transform 0.5s ease, opacity 0.5s ease; /* Combine transitions for smoother animation */
}
Best regards.
Mageplaza | Top-Rated Shopify Agency | Trusted by 230,000+ worldwide merchants
If our suggestion works for you, please give it a Like or mark it as a Solution!
Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com
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