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

Frontend-Mentor-E-commerce-product-page HTML CSS JS

PhoenixDev22•16,830
@PhoenixDev22
A solution to the E-commerce product page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi everyone, had a challenging time with this one from start to finish.

My struggles, and bugs:

  • toggle menu icon javascript only works on the second and subsequent clicks. not on the first .Any suggestions?
  • I just noticed that the next and previous buttons are not working on the live solution while they are working on the live server, I've tried so many times .no idea how this bug did occur?

I don’t know for sure if the images fit the screen . Please let me know if you find any overflow or other quirks with the images.

I'm still learning about accessibility .

In javascript , I used more basics ways.

Please share your thoughts! Had a great time working on the CSS, the image grid was a new challenge for me. There’s still some more to do like the readme, cleaning up repeating code, and html warnings.

I'd appreciate any comments for improvements or anything I've missed. Thank you!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Miroslav•180
    @miroslavdurin
    Posted over 3 years ago

    Toggle menu icon is working on a second click because you are checking "left" property of a DOM element you named menuBurger inside of inline-styles, but you've set that property inside of a class ".nav" (main.css on line 899). You can write something like this:

    menuBurger.addEventListener("click", function(){
        if (window.getComputedStyle(navBar).left < "0px"){
            navBar.style.left= "0";
            cross.style.display = "block";
            appearOverlay();  
        }else{
            navBar.style.left= "-100%";
            disappearOverlay ();
        }
    })
    

    or

    menuBurger.addEventListener("click", function(){
        if (navBar.getBoundingClientRect().x < 0){
            navBar.style.left= "0";
            cross.style.display = "block";
            appearOverlay();  
        }else{
            navBar.style.left= "-100%";
            disappearOverlay ();
        }
    })
    

    Both of those solutions work fine, but using too much of inline-styled properties is a bad practice. We usually use classes for that kind of job. I would suggest that you check some of the popular Udemy courses or maybe some YouTube videos to see how it's done.

    Marked as helpful
  • Adarsh•1,640
    @adram3l3ch
    Posted over 3 years ago

    HI, this one looks great.

    toggle menu issue

    element.style is used to set or get inline style. you cant get external css styles with element.style.

    svg

    You cant directly set fill on svg , you have to select the path inside svg and set fill on that svg path { fill : #a5d5ef}

    Marked as helpful
  • Soe Wai Yan Aung•410
    @soewaiyanag
    Posted over 3 years ago

    So you want to change fill on hover right? I solve it by creating SVG as a react component. Here is my submitting. But you can solve it with pure CSS too. If you are using vs-code copy the codes inside SVG. And paste it in HTML and treat it as an HTML element. Give it a className and also remove its inline fill attribute(must remove otherwise CSS won't work). Now you can modify fill with CSS.

    Marked as helpful
  • GrischK•140
    @GrischK
    Posted over 3 years ago

    Very good job !!!

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

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

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

Oops! 😬

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

Log in with GitHub