Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

Article Preview Component - Mobile-first Responsive CSS Javascript

bem
Rapha445•100
@Rapha445
A solution to the Article preview component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

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,

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community 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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License