Article Preview Component - Mobile-first Responsive CSS Javascript

Solution retrospective
Hi everyone :)
This was quite a challenging one for me. I have a question about Javascript: I wanted to close the pop-up "share" section by clicking anywhere on the page, so I came up with the following Javascript:
html.addEventListener("click", function (e) { shareLinks.classList.remove("active"); })
And I removed manually the parts of my html that are supposed to open the pop-up like so:
if (e.target !== shareBtn & e.target !== ImgHover & e.target !== shareLinks)
But this can be a lengthy and laborious process. I was wondering if there is a better way to achieve this...
Any solution or any comments more than welcome! Cheers,
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Rapha445's solution.
Join 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