Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Loopstudios-landing-page(Html,Css,Js)

Pranav 500

@pranav1597

Desktop design screenshot for the Loopstudios landing page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


When I click on the hamburger icon, the icon overlaps the close icon. How to remove the hamburger icon when I click on it so the close icon can show. Any feedback appreciated.

Community feedback

Jesse 430

@jesse10930

Posted

Great project, Pranav! Another option to fixing the issue you raised is to create a class to toggle on the hamburger image, the same way you do for the '.active' class. Something like:

.hide {
   display: none;
}

So when the hamburger is clicked, its image will not be displayed. When the close is clicked, the hamburger will come back into view. Hope this helps!

Marked as helpful

0

Pranav 500

@pranav1597

Posted

@jesse10930 Thanks you Jesse for the suggestion, so I have to put hamburger-image. hide just like hamburger-image. active, right?

0
Jesse 430

@jesse10930

Posted

@pranav1597 Well, you'd have to look at the way your document is structured and toggle "hide" class on the image(s) you want to disappear and reappear. Looking at your code, you'd likely have to move some things around to implement this solution. HTML:

<a href="#" class="hamburger-icon">
    <img src="images/icon-hamburger.svg" alt="" class="hamburger-image" id="ham-img">
    <img src="images/icon-close.svg" alt="" class="close-image hide" id="close-img">
</a>

CSS:

.hide {
    display: none;
}

JavaScript (placed inside the 'onclick' function you have):

document.getElementById('ham-img').classList.toggle('hide');
document.getElementById('close-img').classList.toggle('hide');

The ".hamburger-image.active" wouldn't be needed anymore.

So the idea is that the "hide" class goes back and forth between the hamburger image and the close image when the user clicks the image that is displayed. The image that is clicked disappears and the other image appears.

1
Pranav 500

@pranav1597

Posted

@jesse10930 Okay, Thanks for the help Jesse.

0
Anurag Singh 1,265

@exist08

Posted

when it comes to use a svg as image use a div and then set the background-image of svg ,, when div.active change background-image ,,, hope it'll help

1

Pranav 500

@pranav1597

Posted

@exist08 Thanks Anurag for the help, I will look into it.

0

Please log in to post a comment

Log in with GitHub
Discord logo

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