JavaScript - How to Create a Responsive Hamburger Menu with HTML, CSS, & JavaScript

Sdílet
Vložit
  • čas přidán 28. 08. 2024
  • In this tutorial, you'll learn how to create a responsive hamburger menu using HTML, CSS and JavaScript.
    Sponsor me on GitHub!
    github.com/spo...
    Follow my blog:
    / miguelznunez
    Email : mignunez@csumb.edu
    Medium : / miguelznunez
    Codepen : codepen.io/mig...
    GitHub : github.com/mig...

Komentáře • 316

  • @adam3720
    @adam3720 Před rokem +53

    In case anyone encounters an error with the JavaScript code not working, remove the script tag inside the tag and add it inside the body right before the tag. That way, the javascript code will be executed after the HTML Document has fully loaded. Your welcome!

  • @mary-hu3ff
    @mary-hu3ff Před 2 lety +52

    One of the best tutorials I have seen up until now in JS for a simple dynamic!
    Even tho it's a simple topic, some people over complicate their tutorials so much, thank you!!!

  • @teenytinytoons
    @teenytinytoons Před 2 lety +8

    Literally the best hamburger tutorial out there hands down. Took me forever to find one where I could understand. Bravo!!

    • @tmm476
      @tmm476 Před 2 měsíci

      stfu its not

  • @naidenlambev4929
    @naidenlambev4929 Před 2 lety +28

    Hello and thank you ! This has helped me a lot. By far the cleanest tutorial and the best explanation. Thank you for giving us such a powerful content. Cant wait to see more from you !

    • @edwardwilson4272
      @edwardwilson4272 Před 2 lety

      I agree, I've looked at a few others and this is the best one so far. Really useful JS concepts in here too. Thanks Codefoxx!

  • @thetr8r469
    @thetr8r469 Před 7 měsíci +1

    Genuinely a really big help for my website. I had put off making a popup menu for so long because the last explanation I saw made my head spin. This was easy to digest and easily customizable. Big thanks.

  • @evelyntelevision
    @evelyntelevision Před rokem +7

    Thanks for this! I searched all over for a simple, straightforward tutorial on making a collapsing navbar/hamburger menu like this, and yours is the best! I appreciate you getting straight to the point.

  • @nkanganthony9794
    @nkanganthony9794 Před rokem +3

    You have got some way to deliver what no one else can in my many years or self learning. Thank you so much.

  • @sabrinashamsiddinova7691

    Best easy responsive menu tutorial I found after scrolling thro internet for an hour

  • @jamesdeske4327
    @jamesdeske4327 Před rokem

    Of the 1 million Menu tutorials I have seen this is the BEST

  • @akshaykhatri2027
    @akshaykhatri2027 Před 2 lety +3

    Probably one of the best 😂 stuff, the way you turned hamburger into cross. Appreciable 🌸✨👍

  • @urosmalic7818
    @urosmalic7818 Před 2 lety +2

    This with hamburger and adding spans blew my mind till now i was just adding font awesome icons, this sure teaches u that you can do awesome things with only basics

    • @T25de
      @T25de Před 2 lety

      very true

  • @vendettamalize7209
    @vendettamalize7209 Před 2 lety +2

    Thanks you saved my life from hamburger hell, from now on you're my master you have my subscription.

  • @BryantCobarrubias
    @BryantCobarrubias Před 2 lety +2

    Great demo. I adapted this for my react site. Adding comment to boost your YT algorithm. :)

  • @sorane8910
    @sorane8910 Před rokem

    You don't know how much pain I had to make that thing work, and it never worked until I discover this video.
    Thank you a lot.

  • @ashwinsaxena4734
    @ashwinsaxena4734 Před 2 měsíci

    The best video to make a responsive nav bar. Thanks for the video!

  • @viveLaCifte
    @viveLaCifte Před 26 dny

    This was an amazing tutorial, thank you.

  • @rulleywanjau6498
    @rulleywanjau6498 Před 2 lety +3

    Thanks these has been a very educative tutorial,has helped me as a student doing computer science ,simple brief and direct to the point

  • @tobiasbremner9623
    @tobiasbremner9623 Před rokem +2

    Despite how short the video was, the developer did a great job explaining explaining the most important lines of code and why he put them there.
    This great tutorial greatly reduced my work load. Great Job.
    One small nitpick. As other commenters already said, be sure to mention the JavaScript link in the body. I would suggest taking a couple of seconds at the beginning of the video to show your index page, and point out your CSS link and your JavaScript link for your beginner viewers.
    Again, great video and thanks for the help.

  • @JhonnyBueno
    @JhonnyBueno Před 2 lety

    My guy, you helped me a lot in javascript, I had a problem with my Responsive Menu, I thank you immensely, because I solved my case, congratulations for the video.

  • @kiimkeophukdee8031
    @kiimkeophukdee8031 Před rokem +1

    You've just save my life!!!

  • @henriquepinheiroxavier

    Thank you very much. Your video was the only one that I understood. I spent my entire weekend trying to learn this menu burger and could not understand it. Your video taught me!

    • @codefoxx
      @codefoxx  Před 2 lety

      Anytime, im glad i could help

  • @joshuamichael845
    @joshuamichael845 Před rokem

    I've learnt alot since I subscribed to this channel, your videos are always comprehensive and precise.

  • @sayantandey4708
    @sayantandey4708 Před 2 lety +1

    Making the cross was dope ...
    You deserve more subscriber...

  • @JoseMedina-in6ji
    @JoseMedina-in6ji Před 8 měsíci

    I just want to say that you are the shit!! Keep it up brother, you'll definitely grow on CZcams doing this stuff, good voice, right pace, great and simple coding (no homo). I rarely comment. and even less subscribe! You earned the subscribe hands-down. I Look forward to seeing more content.
    funny story, I spent 30 minutes trying to figure out why JavaScript wasn't working (first time with JS), just to realize that my dumbass didn't do the hamburger class on html, SMH.
    peace!🤙

  • @JC-hb2ob
    @JC-hb2ob Před 2 lety +3

    Thank you very much for this tutorial. I am a beginner and it was really well explained which makes it easier to understand.

  • @Coco-ii2pu
    @Coco-ii2pu Před rokem +1

    Thank you sooo much. Been troubling myself with bootstrap all this while when I could have just made mine. This tutorial helped a lot ❤️

  • @CHIDINMAOKEMUO
    @CHIDINMAOKEMUO Před 6 dny

    Thank you so much. It was indeed helpful.

  • @jmid6358
    @jmid6358 Před 2 lety +11

    hi, great tutorial, nicely explain. but I've got a little problem. nothing happens when I click the burger button. I checked the code and everything seems to be right. it just doesn't do anything. any advice?

    • @vojtechsapousek1349
      @vojtechsapousek1349 Před 2 lety

      same

    • @alkanpone
      @alkanpone Před 2 lety +1

      Hi, open your website in Chrome and press F12, there you can see logs. If the button doesn't respont i rec you look at the Action Listener part. Hope it helps :)

    • @xt0ferx
      @xt0ferx Před 2 lety +1

      that was happening to me, I moved the javascript call to the end of my html file and it worked fine after that

    • @favourewulo5358
      @favourewulo5358 Před 2 lety

      @@alkanpone what should i do to that part

    • @gamechangers6946
      @gamechangers6946 Před 2 lety

      Same issue with me

  • @kunoichikun
    @kunoichikun Před 2 lety +1

    thankyou! was able to incorporate into my existing code easy and now everything looks so much cleaner to what i was doing before!

  • @giulia6930
    @giulia6930 Před 5 měsíci

    Thank you, clear and step by step explanation. I was looking for this!❤❤

  • @tomcox8801
    @tomcox8801 Před rokem +1

    This was a great tutorial. I was looking for a simple way to add a hamburger menu and this was perfect. Nice and simple and clean. Thank you.

  • @HikerMike28
    @HikerMike28 Před rokem +2

    So the hamburger menu button isn't even displaying for 😅😩 any ideas on what to do it's driving me crazy

  • @berndberndo9581
    @berndberndo9581 Před rokem +2

    My Hamburger Menu isn‘t working can anyone help me ?

  • @UrCristiano-x8v
    @UrCristiano-x8v Před 2 lety

    The best js tutorial that i have ever seen, thanks bro.

  • @superrnaah
    @superrnaah Před rokem

    was trying to figure out the js to close the hamburger on link click and found it in this video. Thank you!

  • @KozenDGray
    @KozenDGray Před 2 lety +1

    Yo man great tutorial, best one i've found so far.

  • @ravitejadarla3882
    @ravitejadarla3882 Před 2 lety

    I ever seen this kind of clean explation video you made my day, but only thing we need to look into it when we have menu-links than we unable to scroll up & down I request you to check that please make a video on huge menu navigation bar sir....

  • @mahdigholami3916
    @mahdigholami3916 Před rokem +1

    Greet tutorial, simple and clear.. many thanks for what you are doing man!

  • @jagannathps
    @jagannathps Před 2 lety

    If i saw this video earlier it could have saved a lot of time

  • @bd-webtutor
    @bd-webtutor Před 2 lety

    Thank you very much. I was struggling to make my navbar responsive, your video has helped me a lot. It was very easy to follow.

  • @leroymokobi2928
    @leroymokobi2928 Před rokem

    Very simple, clear and straight forward. Yhanks a lot

  • @nnejiben
    @nnejiben Před rokem

    This video is awesome and so helpful! Little wonder it came tops in my search result.

  • @martienvliet8812
    @martienvliet8812 Před 2 lety +1

    tysm, this helped me so much, cool vid bro keep up the good work

  • @spiritualforce
    @spiritualforce Před rokem

    Damn! You made this look a cake wake for us. New subscriber bro!!

  • @spicydoge3847
    @spicydoge3847 Před rokem +1

    Great video. With some modifications to the code you presented in the video I was able to make a responsive dropdown style menu.

  • @yankeesfan3961
    @yankeesfan3961 Před rokem +1

    If you don't know Java Script at all then you are in trouble, but it's very good to a point.

  • @hannahsaseun2381
    @hannahsaseun2381 Před 2 lety +1

    this was really helpful. thank you for making it so simple for me

  • @LightJackKirin
    @LightJackKirin Před rokem

    Splendid video!! Kudos to you mahn. 😮😅

  • @trevormadden4301
    @trevormadden4301 Před 2 lety +1

    Cheers man. Nicely put

  • @photoinshot1355
    @photoinshot1355 Před 8 měsíci

    Great video, well explained and demonstrated, easy to follow understand and implement because the tutorial is so well presented. Thanks! Was a great help.

  • @elvirakopstala6519
    @elvirakopstala6519 Před 2 lety +2

    Thank you! This was super helpful.

  • @muhammadakram1701
    @muhammadakram1701 Před 3 měsíci

    The best tutorial

  • @giulia6930
    @giulia6930 Před 9 měsíci

    thanks, you enlighted me. it's really hard to find a clear explanation.

  • @enssahfayiamomoh8410
    @enssahfayiamomoh8410 Před rokem

    This video is very insightful... thank you a lot...I have learned so much from the video

  • @kzhang3835
    @kzhang3835 Před 4 měsíci

    Thank you so much. This really works. 👍

  • @NiceChange
    @NiceChange Před 10 měsíci

    Thus is some great resources. Great work!!!!

  • @fannienatourz
    @fannienatourz Před rokem

    Thank you so much for this tutorial!
    This was a life saver. Trust me!😅

  • @obadayahya6176
    @obadayahya6176 Před 9 měsíci

    Thanks man !!! , your video was awesome keep up the good work

  • @prashantmishra5691
    @prashantmishra5691 Před 4 měsíci

    Great stuff. Subbed!

  • @rakibhasan9401
    @rakibhasan9401 Před 2 lety

    Thanks man! I appreciate your all the efforts buddy! you cracked complicated matters in the simplest way. #respect

  • @edbarr1379
    @edbarr1379 Před rokem

    With the JS file I had to change nav-Menu class to navMenu for the mobile menu to work, and for the class .navbar, use justify-content: space-around, worked best for me to avoid adding padding. Overall great Vid, helped me to get my boiler plate with nav included, now I just change the CSS variables to modify the colors.

  • @ff0x
    @ff0x Před 2 lety

    Thankyou so much for this. You've earned another subscriber - great video :)

  • @SeleDreams
    @SeleDreams Před rokem +2

    I recommend to not use pixel units, it's better to rely on em and rem

  • @HayWhy_Pappy
    @HayWhy_Pappy Před rokem

    Not sure why a simple hamburger menu should be the most difficult thing on earth. And all of these youtubers can't make a simple nav bar like this. Hell. So simple and straight to the point, you should teach other tech youtubers how to be simple and straightforward. Phheeeew

  • @oppai.dragon
    @oppai.dragon Před 2 lety +2

    Dude all done but in mobile menu i found the transparency.....my hamburger menu is transparent even though i have set background but the down home section items overshadowed it

  • @deeeera
    @deeeera Před 2 lety +1

    Wow. It could be this easy? Thank you so much. New subscriber here.

  • @dktk7
    @dktk7 Před 2 lety +1

    Thank You, this tutorial was so easy to understand. 😁

  • @user-ch9ep2ol9r
    @user-ch9ep2ol9r Před rokem

    Thank you so much for a brilliant tutorial!

  • @roberttanasie5943
    @roberttanasie5943 Před 2 lety

    Hello, you have an excellent way of explaining and your videos are on point and easy to understand !!!

  • @_heyise
    @_heyise Před 10 měsíci

    This is very helpful. Thank you for this!!

  • @MrBrady95
    @MrBrady95 Před rokem +1

    Awesome, thanks! Liked and subscribed!

  • @codewithsehran
    @codewithsehran Před 3 měsíci

    simplicity: 💯
    understandability: 💯

  • @vikisneakers
    @vikisneakers Před 9 měsíci

    What a wholesome tutorial, everything worked smoothly sir

  • @klaasjanssen644
    @klaasjanssen644 Před 2 lety

    beautiful smooth menu, great job! thx for this video

  • @wawananggana5129
    @wawananggana5129 Před 2 lety

    Simple and straight tutorial.. thank you..

  • @simasgradeckas4259
    @simasgradeckas4259 Před 2 lety +3

    Super clear & brief tutorial - thanks a lot!

  • @user-bi6vp5gy5h
    @user-bi6vp5gy5h Před 2 lety +1

    Спасибо, все получилось лайк

  • @3reinaldo
    @3reinaldo Před rokem

    Easy, and clean, thanks its a great tutorial

  • @ocel1416
    @ocel1416 Před 2 lety

    Great tutorial! You help me so much. This tutorial was it what i needed.

  • @andreapretorius873
    @andreapretorius873 Před rokem

    This is so amazing, thank you so much. It was so easy to follow and understand what you were doing.

    • @lazy-hero.
      @lazy-hero. Před rokem

      Is it working?

    • @arthurradium5823
      @arthurradium5823 Před rokem

      @@lazy-hero. it doesnt work for me... (yes i inserted the script link at end of the body) . nav-menu dont appear after clicking on the burger!

  • @Firzj
    @Firzj Před 2 lety

    thank you for the JS hamburger code (to close it when clicking links) I'm total noob but i finally made my hamburger menu work as intended 👍👍👍

  • @Rain_berries
    @Rain_berries Před 2 lety +1

    Man thank you so much. this has really helped me. ❤

  • @vagabondideas9685
    @vagabondideas9685 Před rokem

    Excellent! Thank-you

  • @MrOrganicz
    @MrOrganicz Před rokem

    Great Video! This really helped me a lot!

  • @Justhue
    @Justhue Před 9 měsíci

    Thank you this is so helpful

  • @eliasmailosson9547
    @eliasmailosson9547 Před 2 lety

    Such a good video man, Thank you!

  • @microhandsltd
    @microhandsltd Před 2 lety

    A great video, I thank you. I'm studying IT at University and this has inspired me to go that extra bit.

  • @xanny3690
    @xanny3690 Před 2 lety +1

    Good tutorial man 🖤

  • @hamzanakan629
    @hamzanakan629 Před 2 lety +1

    thanks for this tutorial, it helps me a lot

  • @jakob6123
    @jakob6123 Před rokem

    Solid tutorial

  • @Larsson037
    @Larsson037 Před rokem

    i get the x animation when pressin it but the menu wont show up, help please.

  • @PrinceSharma-gq5is
    @PrinceSharma-gq5is Před 18 dny

    Very Useful

  • @promiseuka
    @promiseuka Před 2 lety

    Wow, this is an amazing tutorial

  • @aminul.islam.
    @aminul.islam. Před 6 měsíci

    amazing. thank you

  • @mcpeko
    @mcpeko Před rokem

    Great stuff. Subscribed. 🍻

  • @Bigkcee
    @Bigkcee Před rokem

    Thanks for the video it really was helpful

  • @user-zw6fx5ro4y
    @user-zw6fx5ro4y Před 2 lety +1

    Hi, thank you very much! This video really helped me!!!!

  • @NashiEXC
    @NashiEXC Před měsícem

    Hi, quick question, how would you make it move in from the right instead of left? i tried changing the Left:0; in the css to Right:0; and it just doesn't show up

  • @graybab
    @graybab Před rokem

    You are a lifesaver

  • @theshelbypalace
    @theshelbypalace Před rokem

    this is great video! thank you sooooo much!