Design comparison
Solution retrospective
I cannot get the social box to hide when the same button is pressed on desktop view. Let me know where I went wrong in my script.
Over all layout and styling with size and typography are not exactly like the original. I'm interested in hearing methods to better imitate the mock ups. Any and all suggestions are welcome :)
Community feedback
- @grace-snowPosted about 3 years ago
Hi
This doesn't work for me. Events should never fire off elements like image or anything non-interactive. If you use a button it might work
Marked as helpful1@grace-snowPosted about 3 years agoIn fact, if I click with a mouse not keyboard it is catching the event (still must be changed to a button) but the javascript isn't working. Social stays hidden and visible gets logged to console.
Once this is a button, it needs to have an aria-expanded attribute on it. You only need one event listener, eg.
toggleShare
That function needs to:
- toggle the hidden class
- toggle the aria-expanded value
There is no reason for there to be two functions, or for it to add/remove other classes like flex. You can handle that already in css
Good luck
Marked as helpful0 - @PhilJGPosted about 3 years ago
@grace-snow Yes I
m not sure why the script doesn
t work on my live site. Something must have happened when I uploaded onto github. Im still new to github and markdown and I can
t figure out how to push my updates to it.But I have taken your suggestions into account and now I have the toggle working :) I was not familiar with '.toggle' until now!
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