Design comparison
Solution retrospective
I'm quite confused about how to position the box so it can be responsive. So I made it a fixed size to the card. Because of my limitations on javascript, the accordion I can make is simple. But enough to help me understand javascript better.
Community feedback
- @dwhensonPosted over 3 years ago
hey @priopambudi nice work on this one. It looks good responds nicely, and functions well. Here are a few things you might like to consider:
-
I prefer to avoid JS where possible. One thing that really helped me with this one was the use of the details and summary HTML elements. These have much of the functionality baked in and can be styled with a little bit CSS work.
-
This would also have the advantage of including keyboard functionality and allow the key elements to be focusable automatically. This is missing at present so I can only use my mouse to open the elements.
-
If you went with this approach you can also animate the opening and closing pretty simply using some code like:
details[open] summary ~ * { animation: sweep 0.2s ease-out; will-change: opacity, transform; } @keyframes sweep { 0% { opacity: 0; transform: translateY(-1em); } 100% { opacity: 1; transform: translateY(0); } }
If you add in some
outline
styles I think this would leave you with a pretty robust, and accessible component. But, all that aside, you've done a great job here, and positioning all those images is not easy! Nice one šHope this helps a little.
Cheers š
1@priopambudiPosted over 3 years ago@dwhenson You really are very kind. At first I considered not using javascript. But after trying it, I couldn't do it. Finally I decided to use javascript at the same time to learn, because I'm still a beginner. Thank you very much for your advice. I'll try later. Thank you so much!
0 -
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord