Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Responsive Faq Accordian Using HTML CSS JS

Enayut•10
@Enayut
A solution to the FAQ accordion challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Just finished my first website using HTML, CSS, and JS. It works well on both computers and phones, thanks to the mobile-first approach. Curious to hear what you think!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Dean•480
    @Deanogit
    Posted over 1 year ago

    Hey @Enayut,

    Great work getting this solution submitted

    I was just taking a look at your code and noticed something you might be interested in.

    The background images are not loading due to a small error in the syntax.

    Your code:

    function changeImg(){
          let width = window.innerWidth
          console.log(width)
          if (width > 700) {
              img.setAttribute("src","/assets/images/background-pattern-desktop.svg");
          } else {
              img.setAttribute("src","/assets/images/background-pattern-mobile.svg");
          }
    

    try adding a . in-front of the first / when declaring the image paths.

    Try checking the syntax for the icons too

    I hope this helps

    Great effort building this solution

    Marked as helpful

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
Frontend Mentor logo

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub