Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Answered toggle bar not responding

nil14

Coder
hey a total newbie to web development here , I'm just trying to create a "slide menu"/toggle bar(?) in which you get the item list when clicking the on the the 3 lines , anybody could tell me why it's not working for me ? I copied a code from a tutorial but I don't know how to fix the problem / and yes I activated the function in js .
 

Attachments

  • scdge.png
    scdge.png
    46.1 KB · Views: 6
  • sshtm.png
    sshtm.png
    10.9 KB · Views: 6
Solution
Hey @nil14,

So I was able to get the toggle bar to work, here are the screenshots:

Screenshot 2022-02-27 at 21-27-04 Art By Nil.pngScreenshot 2022-02-27 at 21-27-11 Art By Nil.png

This can be accomplished from within the styles.css file, you need to replace display: grid under .navbar__menu with display: none. Then under .navbar__menu.active add display: grid.

With this change, we are making sure that when the toggle bar is not active we are not displaying any menu items, however when the toggle is pressed then we display it as a grid.

CSS:
 .navbar__menu {
    display: none;
    grid-template-columns: auto;
    margin: 0;
    width: 100%;
    position: absolute;
    transition: all 0.5s ease;
    height: 50vh;
    z-index: -1;
    background: red;
 }
    
 .navbar__menu.active...
Hi @nil14,
Please do not show pictures of code, but copy and paste it into the code feature (</>).

Also, I need to see more than just a portion of your CSS, I need to see HTML and JS too.
 
Hey @nil14,

So I was able to get the toggle bar to work, here are the screenshots:

Screenshot 2022-02-27 at 21-27-04 Art By Nil.pngScreenshot 2022-02-27 at 21-27-11 Art By Nil.png

This can be accomplished from within the styles.css file, you need to replace display: grid under .navbar__menu with display: none. Then under .navbar__menu.active add display: grid.

With this change, we are making sure that when the toggle bar is not active we are not displaying any menu items, however when the toggle is pressed then we display it as a grid.

CSS:
 .navbar__menu {
    display: none;
    grid-template-columns: auto;
    margin: 0;
    width: 100%;
    position: absolute;
    transition: all 0.5s ease;
    height: 50vh;
    z-index: -1;
    background: red;
 }
    
 .navbar__menu.active {
    display: grid;
    background: black ;
    top: 100%;
    opacity: 1;
    transition: all 0.5s ease;
    z-index: 99;
    height: 50vh;
    font-size: 1.6rem;
 }
 
Solution
Hey @nil14,

So I was able to get the toggle bar to work, here are the screenshots:

View attachment 1325View attachment 1326

This can be accomplished from within the styles.css file, you need to replace display: grid under .navbar__menu with display: none. Then under .navbar__menu.active add display: grid.

With this change, we are making sure that when the toggle bar is not active we are not displaying any menu items, however when the toggle is pressed then we display it as a grid.

CSS:
 .navbar__menu {
    display: none;
    grid-template-columns: auto;
    margin: 0;
    width: 100%;
    position: absolute;
    transition: all 0.5s ease;
    height: 50vh;
    z-index: -1;
    background: red;
 }
   
 .navbar__menu.active {
    display: grid;
    background: black ;
    top: 100%;
    opacity: 1;
    transition: all 0.5s ease;
    z-index: 99;
    height: 50vh;
    font-size: 1.6rem;
 }
yeah it looks much better now , thank you very much !!
 

Latest posts

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom