Responsive Navigation Bar with HTML CSS and Javascript | Responsive Menu

Поділитися
Вставка
  • Опубліковано 18 лис 2024
  • Enroll My Course : Next Level CSS Animation and Hover Effects
    www.udemy.com/...
    Another Course : Build Complete Real World Responsive Websites from Scratch
    www.udemy.com/...
    ------------------
    Join Our Channel Membership And Get Source Code Everyday
    Join : / @onlinetutorialsyt
    ------------------
    Please LIKE our Facebook page for daily updates...
    / online-tutorial-html-c...
    ------------------
    Responsive Dropdown Navigation Bar with HTML and CSS
    • Responsive Dropdown Na...

КОМЕНТАРІ • 278

  • @OnlineTutorialsYT
    @OnlineTutorialsYT  6 років тому +17

    please like and share this video...
    and also SUBSCRIBE my channel for daily new video...and don't forget to press the bell icon for daily notification

    • @alanashton8956
      @alanashton8956 6 років тому

      typed in code for code and toggle does not work
      4index.html:26 Uncaught TypeError: $(...).toggleclass is not a function
      at HTMLElement. (index.html:26)
      at HTMLElement.dispatch (jquery-3.2.1.js:5206)
      at HTMLElement.elemData.handle (jquery-3.2.1.js:5014)
      this comes up haha HELPPPP!!!!!

    • @alanashton8956
      @alanashton8956 6 років тому

      don't matter figured it out haha x

    • @notmeiko
      @notmeiko 6 років тому +2

      !!!! you still didn't fix the problem with the active class bc it doesn't work for many people including me

    • @notmeiko
      @notmeiko 6 років тому

      i found it

    • @VinnyPlueschebaer
      @VinnyPlueschebaer 6 років тому

      @@notmeiko how Dude?

  • @wolfmountaingames291
    @wolfmountaingames291 6 років тому +7

    For those of you who could not get the click to dropdown to work:
    Make sure you included before the .

    • @wolftijuana
      @wolftijuana 6 років тому

      doesn't work :(

    • @incurvateursubtil9075
      @incurvateursubtil9075 6 років тому

      He mean, to surround the ..... with a ,
      like -->

    • @tylerwelch2181
      @tylerwelch2181 6 років тому

      You're a saint

    • @learntocode1878
      @learntocode1878 4 роки тому

      WolfMountain and Incurvator
      Thank you so much guys, was really struggling to get the menu to drop down. I have wrapped the tag with menu as you guys explained and manage to get it working. Thank You both

  • @amguruprasath8037
    @amguruprasath8037 5 років тому +23

    Use this instead of Jquery
    let menu = document.querySelector('.menu')
    menu.addEventListener('click', (e) => {
    document.querySelector('ul').classList.toggle('active');
    })

  • @iamtheharish
    @iamtheharish 6 років тому +17

    To not disturb whole body with sliding down of UL content.
    Add,
    nav{
    position: relative;
    }
    ul{
    position: absolute;
    background: inherit;
    }
    in media query.
    Have fun amigos!!

  • @kaissoune
    @kaissoune 3 роки тому

    I couldn't believe it, as pretty as amazing work, All praise is due to God, I just give thanks to God, "you do the first tasks of my work" Be grateful for your thoughtfulness! God willed it! I have a lot of homework this one is the number one to do it! before thinking about how could I do it, I have happily played with mom and I made her happy and I told her, now I'm gonna work on many projects, she told me, with a smile, son "God knows " when I checked my phone this first video shown of my screen! I just give thanks to God!
    May God Grant it to this team!
    😊 😊 😊😊

  • @Bigmommajill
    @Bigmommajill 5 років тому +1

    Thank you - this is the best way to learn responsive bar menu I have seen! Thanks a million!

  • @marcinn7518
    @marcinn7518 6 років тому

    Great thx man! I tried all day to do it without result, but with you tutorial i did it in 30 min! lov u

  • @yOkay_
    @yOkay_ 5 років тому

    with that music... everything stays relaxing for work

  • @I_dont_want_an_id
    @I_dont_want_an_id 4 роки тому +1

    For thos who's OWN INTERPERTATION on this navbar didnt work. I went through the pain.
    Here's what to do:
    1. Delete that jquery thing, and delete the css class ".active"
    2. on the div surrounding your navicon or svg add this: onclick="hideAndShow()" (mine looks like this: )
    3. add an id to the ul-tag (, mines called: id="ul")
    4. and in javascript you should copy this if-statement. and replace the ('ul') with your id name
    heres what your code should look like:
    function hideAndShow() {
    var x = document.getElementById('ul');
    if (x.style.display === 'none') {
    x.style.display = 'block';
    } else {
    x.style.display = 'none';
    }
    }
    srsly, shouldnt have got to know this without God's (Jesus' fathers) help :'""D!

  • @babyprintz
    @babyprintz 5 років тому +3

    This was a great tutorial! Straight-forward, easy to follow steps. Thank you. P.S. The music was soothing too, thanks for that.

  • @shahnazmandal1306
    @shahnazmandal1306 7 років тому +14

    thanks a lot sir. I can't believe you help me this way. really thank you so much. No youtuber help me like this. this video totally solve my problem.

    • @mistersir3185
      @mistersir3185 7 років тому +6

      like totally totally?

    • @shahnazmandal1306
      @shahnazmandal1306 7 років тому +3

      I am uncomfortable ?

    • @webcode6992
      @webcode6992 6 років тому

      Responsive Menu Toggle Without JavaScript
      ua-cam.com/video/Nc-aSM12BIA/v-deo.html

    • @dfdfg5646er
      @dfdfg5646er 6 років тому

      hello where r u from? puk?

  • @detutorial
    @detutorial 6 років тому

    You are the best css maker bro...
    Please make a tutorial "how to make responsive one page for company profile"

  • @anuragkasudhan3734
    @anuragkasudhan3734 4 роки тому

    thanks a lot sir. it really helped me a lot to learn this new concept of media query and css. thanks a lot. it was so much helpful

  • @izzykhan2143
    @izzykhan2143 4 роки тому

    How would you fit a logo in on the right side of the nav bar? I have added it but it won't go inside the blue box next to the words but instead just below. I tried placing inside the tag but this didn't work either

  • @christianirwandi4449
    @christianirwandi4449 6 років тому

    thx for the tutorial, btw why if i change the into , it doesnt work? thankss

  • @bridgetshidok3811
    @bridgetshidok3811 4 роки тому

    I loved this. Been searching for a video like and was really easy to understand 👍🏾

  • @rahmanitaaulia7648
    @rahmanitaaulia7648 4 роки тому

    This is what i've been searching for, thank you, it was helpful❤

  • @captain687
    @captain687 6 років тому

    what tool are you using to test the responsiveness? its great.

    • @notmeiko
      @notmeiko 6 років тому

      just right click in browser, inspect and on the left top corner of inspect you see a screen with a cursor an next to it a mobile and pc click on that. yr welcome

  • @LawZist
    @LawZist 7 років тому

    Do you use bootstrap ,etc when you build websites and such?

  • @danielmichael8567
    @danielmichael8567 5 років тому

    Great video
    straight to the point

  • @mdobaidullahal-faruk3457
    @mdobaidullahal-faruk3457 5 років тому

    Very much helpful tutorial.

  • @idknejejek
    @idknejejek 5 років тому +2

    i write the same code but it dosen't work with me?

  • @warnerjohn6530
    @warnerjohn6530 5 років тому +1

    Sir plz tell me that how can I make multiple sub menu along with this code?

  • @malikkingxd9803
    @malikkingxd9803 6 років тому

    Wow yaar Supperb sir its Really amazing video

  • @PankajKumar-by8ej
    @PankajKumar-by8ej 7 років тому +4

    I'm doing exactly what you are doing, but the last step isn't working for me. I can't click the actual hamburger icon and I have no idea why. You are Call "Menu" But now is call to "Active function" don't give wrong idea

    • @mackeditinghd9319
      @mackeditinghd9319 6 років тому +2

      same here, found a fix?

    • @its-hak
      @its-hak 6 років тому

      subscribe
      ua-cam.com/channels/cPVUpU3kSI6TfUt6BoGtFg.html

    • @mrakstudio13
      @mrakstudio13 6 років тому

      I have the same problem too, how can I fix it? please

    • @tomasl745
      @tomasl745 6 років тому

      @@mrakstudio13
      I put the script in head tag and this worked for me
      $(document).ready(function() {
      $(".menu").click(function() {
      $("ul").toggle();
      });
      });

  • @learntocode1878
    @learntocode1878 4 роки тому

    Thanks for the tutorial

  • @shuqrankhalid6982
    @shuqrankhalid6982 4 роки тому

    Thanks this is very helpful

  • @learntocode1878
    @learntocode1878 4 роки тому +1

    Not working for me, tried following step by step struggling when it comes to java bit. Cant get the menu to drop down

  • @SachinGupta-dh1cf
    @SachinGupta-dh1cf 4 роки тому +1

    Good tutorial

  • @thevaedit
    @thevaedit 6 років тому +4

    Thank you everythings ! :)

  • @mirmil11
    @mirmil11 5 років тому

    Great tutorial!
    Thank you!
    Music was excellent too!

  • @hammadbhat7687
    @hammadbhat7687 5 років тому +10

    I have never been so depressed before

  • @emmysteven
    @emmysteven 7 років тому

    I really appreciate the effort in putting this wonderful resourceful video together and I will appreciation if you give a link to the source codes used in the video

  • @emmamckellar4684
    @emmamckellar4684 6 років тому +1

    Ahh this was amazing and did exactly what I needed. Thank you!

  • @charleskitchton5177
    @charleskitchton5177 6 років тому +16

    Great tutorial. Clean, simple and to the point. What is this music?

  • @lucberger5542
    @lucberger5542 6 років тому

    Thanks for the tutorial! Works perfectly.

  • @Grewal0007
    @Grewal0007 7 років тому +1

    best video of your channel........keep coming....upload "footer with social networking icons".

  • @mandirin3293
    @mandirin3293 6 років тому

    I have a side navigation bar which is on the same horizontal level as my text with animations. When i go to click over the navigation bar links, the hit box for each of the links is jagged and disjointed. I have been playing around with widths and floats but the only way to stop the hit box interference is to have it on a different horizontal level than my text with animation. This *is* a problem with the JS as when i do not use the JS, the hit boxes return back to normal. Please help!

  • @hgkoba4276
    @hgkoba4276 3 роки тому

    Very Thaks! I love u man!

  • @baxtearahmad4260
    @baxtearahmad4260 6 років тому

    welldone

  • @yashsomaiya8544
    @yashsomaiya8544 7 років тому

    Doing great work brruh...helping hand for beginners like me..!!!

  • @ahsanfarid5247
    @ahsanfarid5247 5 років тому

    Bhai media query mai jo ap neah active name ki class likhi hai woh class toh ap neah html mai kahin bhi declare hi nahi ki toh is k barey mai bata dain

  • @jettburns8879
    @jettburns8879 6 років тому

    Aha, it didn't occur to me the class could be toggled to give the list a different display; I was setting style.display with JS which was causing issues. Helpful video!

  • @satishmaurya2089
    @satishmaurya2089 4 роки тому

    In a single page website when click is on link the corresponding section is coming under the fixed header what should I do to fix it help me out.

  • @anudeeproy3998
    @anudeeproy3998 6 років тому +1

    Excellent, short and upto the point. Thank you so much

    • @its-hak
      @its-hak 6 років тому

      ua-cam.com/channels/cPVUpU3kSI6TfUt6BoGtFg.html

  • @ProfGilRodrigues
    @ProfGilRodrigues 5 років тому

    Conteúdo muito bom. Parabéns.

  • @smgaming8604
    @smgaming8604 7 років тому +5

    Hey that's was nice but the problem is in mobile version there is no hover effect.

    • @vegachan6887
      @vegachan6887 6 років тому

      me too

    • @anahoua4837
      @anahoua4837 6 років тому

      did u ever hover on your mobile?

    • @RyomaGG
      @RyomaGG 6 років тому

      you don't hover when viewing on mobile anyway

  • @ujjalshill6442
    @ujjalshill6442 6 років тому

    your video was very helpful

  • @vitamax3777
    @vitamax3777 5 років тому

    Hello man! how to make it smooth smooth appearance??

  • @klaudiaromae4511
    @klaudiaromae4511 5 років тому

    Thx. Very good and quick tutorial!

  • @nonpropaganda7092
    @nonpropaganda7092 6 років тому

    Great tutorial, thanks...☺️☺️☺️

  • @bogdanadrian901
    @bogdanadrian901 6 років тому

    you are awesome, tanks for this tutorial.

  • @stephanpetersen3600
    @stephanpetersen3600 5 років тому +1

    Thanks!!! Perfect introduction!

  • @danielgarr4030
    @danielgarr4030 5 років тому

    Please please please, what is the name of the music you used for this video. its familiar but i cant remember it I love the sound. help.

  • @wangi_mw
    @wangi_mw 6 років тому

    you are a genius!

  • @poojarawat4984
    @poojarawat4984 2 роки тому

    Thank you so much ❤️

  • @zackryder1856
    @zackryder1856 4 роки тому

    You written javaScript on video name but you are using jQuery in the video. Why?

  • @njasra
    @njasra 6 років тому +1

    The toggle button is not working in my case....can anybody help

  • @mint-o5497
    @mint-o5497 5 років тому +5

    Wait why cant u just make a variable like onOff and make it toggle depending on the value of it...? Im new so pls tell me

    • @Moodboard39
      @Moodboard39 2 роки тому

      You new? You talk like u a expert

  • @ahsanhabib8464
    @ahsanhabib8464 4 роки тому

    how can i get your source code??

  • @vaibhav31390
    @vaibhav31390 3 роки тому

    how to add transition while open of toggle menu ?

  • @mohsinnaveed9082
    @mohsinnaveed9082 5 років тому +1

    Very Helpful man. Thanks!

  • @CricketTeam111
    @CricketTeam111 4 роки тому

    Sir active class to h he nhi coding m kha se aaya wo 🤔🤔🤔

  • @rangabharathjinka3556
    @rangabharathjinka3556 5 років тому

    Awesome

  • @lyuboslavkakanakov2944
    @lyuboslavkakanakov2944 4 роки тому

    Hello, I did everything the same as you did and on the last step the menu does not appear when clicking on the icon. Could you help me please? Thank you in advance

    • @dhruv9317
      @dhruv9317 4 роки тому

      same problum bro.

    • @dhruv9317
      @dhruv9317 4 роки тому

      last me chutiya banaya hai isne

  • @techshab9060
    @techshab9060 6 років тому

    sir kiya ham boostrap 3 or boostrap 4 ko ak sath marge kar ke bana sakty hn

  • @akimtulaganov5304
    @akimtulaganov5304 5 років тому +1

    got everything same in my code, but toggle doesn't activate ul drop-down

  • @matiascotens644
    @matiascotens644 4 роки тому

    Excelent

  • @mateombar
    @mateombar 6 років тому

    Very good video it's works

  • @j.e.1620
    @j.e.1620 5 років тому

    HI! For some reason when I try to add the bars to my nav bar it kicks all of my CSS code out and just the bars show up above the unformatted list. Anyone have any thoughts?

  • @amimlikhon4544
    @amimlikhon4544 6 років тому

    what's the song's name you used on your tutorial? sounds great!

  • @biswanathbanik
    @biswanathbanik 5 років тому

    i want to create register button right side top can you help me?

  • @dhruv9317
    @dhruv9317 4 роки тому

    Hello, I did everything the same as you did and on the last step the menu does not appear when clicking on the icon. Could you help me please? reply me shortly if you have solution of this problum i think you make fool of all your viewrs becouse the last step doesnt work

  • @crowngalore
    @crowngalore 6 років тому +4

    hi everything works fine but when i click on the icon the menu doesn't show up can i get some help please?

    • @masimumengi5650
      @masimumengi5650 6 років тому +1

      mine wasn't working too until i moved the jQuery links and script just above the body closing tag and i also figured out i had omitted a dot before my class name selector. check that

    • @crowngalore
      @crowngalore 6 років тому

      thank you every much i will give it a try

    • @sam-u-el
      @sam-u-el 6 років тому +14

      Replace menu in the script with toggle or change all toggle to menu
      $(document).ready(function(){
      $('.toggle').click(function(){
      $('ul').toggleClass('active');
      })
      })

    • @YorandeHaan
      @YorandeHaan 6 років тому +2

      Thanks a lot sir ! this fixed it

    • @MarcoAbr1
      @MarcoAbr1 6 років тому +1

      check a div =

  • @eufraniodiogo50
    @eufraniodiogo50 5 років тому

    It was so usefull

  • @joaocesardelima4318
    @joaocesardelima4318 6 років тому

    Very helpful. Thanks!

  • @AaronEstebanSEO
    @AaronEstebanSEO 6 років тому

    What Google Chrome extension are you using to test the responsive design? Does anyone know what he/she is using?

    • @_qry
      @_qry 6 років тому

      It's not an extension. Just right-click any website and then go to "Inspect". Or just click Ctrl+Shift+I and it will open up the Inspect view. Then select "Responsive" in the top bar where you can set the zoom value aswell.
      Sorry 4 bad english ^^
      Good luck!

    • @timberridgecustoms6349
      @timberridgecustoms6349 5 років тому

      I don't think its even an extension per se. Just open your code in Chrome, right click is select inspect. Then you can click the dev tool in the top corner, the icon looks like a tablet/phone.

    • @Moodboard39
      @Moodboard39 2 роки тому

      And yet you never answer but you ask a question ?!

    • @Moodboard39
      @Moodboard39 2 роки тому

      @@_qry I don't understand people ask but never answer back

  • @liviuc1946
    @liviuc1946 6 років тому

    How would you add a transition to the menu when you toggle it?

  • @魔王回首
    @魔王回首 5 років тому

    why in th ul tag, margin 0 auto, not center the ul, but at the left

  • @mayankjha8846
    @mayankjha8846 4 роки тому

    Thank you so much!!!!!

  • @syedjamalrizvi3464
    @syedjamalrizvi3464 5 років тому

    Can you please share CSS code with us.

  • @MikyDev
    @MikyDev 7 років тому +1

    Multi level please with flexbox

  • @sodkolandiawita4417
    @sodkolandiawita4417 5 років тому +1

    Hello,
    give me a link to background music.

  • @harendrasingh_22
    @harendrasingh_22 6 років тому

    Should have lowered width of toggle button and floated it to the right

  • @alessandrocrispino989
    @alessandrocrispino989 5 років тому

    how can i position my navbar to the right?

  • @ArmanKhan-cr2uy
    @ArmanKhan-cr2uy 6 років тому +2

    its awesome

  • @jasonparedes6533
    @jasonparedes6533 6 років тому

    That was beautiful, Thank You!

  • @davida6883
    @davida6883 6 років тому +1

    Im not been able to make the javascript part to work,
    I have it like this:
    Home
    About
    Services
    Contact
    and the script like this:
    $(document).ready(function() {
    $( '.menu').click(function() {
    $('ul').toggleClass('active');
    })
    })
    Do you know why is not working? When I click the menu icon nothing happens

    • @mijoongie7570
      @mijoongie7570 6 років тому +1

      add the jquery cdn you can get it here code.jquery.com/ ..

    • @davida6883
      @davida6883 6 років тому

      I added ,
      This is how i have it:
      $(document).ready(function() {
      $( '.menu').click(function() {
      $('ul').toggleClass('active');
      })
      })

    • @mijoongie7570
      @mijoongie7570 6 років тому +1

      the problem is bcos of ur nav class .. do u code ur css like this:
      ex:
      .navsup ul {
      display:block;
      }
      dont do that instead do "nav ul"
      or add a class on tag
      -- im bad in explaining so gonna post my code below:
      JS MENU NAV

      * {
      padding:0;
      margin:0;
      }
      .navsup {
      background: #333;
      display: flex;
      justify-content: center;
      }
      .navsup a {
      text-decoration: none;
      color:#fff;
      display: block;
      }
      .navsup a:hover {
      background: #222;
      }
      .listMenu{
      list-style: none;
      display: flex;
      }
      .listMenu li {
      padding:.8rem 3rem;
      }
      .listMenu li:hover {
      background: #222
      }
      .toggle {
      display: none;
      background: #222;
      color:#fff;
      font-size: 24px;
      padding: 0 10px;
      }
      .active {
      display:block;
      }
      @media screen and (max-width: 768px) {
      .toggle {
      display: block;
      }
      .menu {
      cursor: pointer;
      }
      .listMenu{
      width: 100%;
      display: none;
      }
      .listMenu li {
      display: block;
      text-align: center;
      }
      .active {
      display:block;
      }
      }


      Home
      Services
      About
      Contact



      $(document).ready(function(){
      $('.menu').click(function(){
      $('ul').toggleClass('active');
      })
      })

    • @ricksonfan7066
      @ricksonfan7066 5 років тому

      @@mijoongie7570 Thank you so much mijoongie!!! You fixed it for me! I was targeting a class I had created in my CSS and the toggle didn't work (MyMenu ul li, etc), but once I read your comment, I changed all my CSS to target nav instead... "nav ul {display: block}" and "nav ul li", etc., then the toggle worked!

  • @mantusuna
    @mantusuna 6 років тому

    how to make a current-menu-link...color active link...??? menu tab

  • @nadiasultana6768
    @nadiasultana6768 4 роки тому

    Can you please provide the source code??

  • @PluffyOP
    @PluffyOP 7 років тому

    is this from ovh website or what

  • @codeordie-uw1il
    @codeordie-uw1il 6 років тому

    i think there is a bug, after i drag and reach 768px or lower and then click the toggle to on/off nav menu, then drag back bigger screen menu gets disappear. its come back after refresh page, hope you got it.

  • @ShahzaibKhan-wh5hh
    @ShahzaibKhan-wh5hh 5 років тому

    sir how to use bootstrap 3 screen size 991 navigation bar please explain

  • @Ombolooo
    @Ombolooo 5 років тому

    this was so freaking helpful, thanks!

  • @tysonjohnson3489
    @tysonjohnson3489 7 років тому

    Do I need th .js outside link? I have no internet... or can I just work with my external .js page?

    • @notmeiko
      @notmeiko 6 років тому

      no internet hah? then why could you post this

  • @Top_knocks_cricket_IPL
    @Top_knocks_cricket_IPL 5 років тому

    same coding lagane k bad bhi work ku nhi kr rha toggle

  • @monusainy1943
    @monusainy1943 5 років тому

    it is not working in my navbar...

  • @sourav_ksharma
    @sourav_ksharma 6 років тому

    what to do if an error occur saying
    newFunction is not defined
    at HTMLElement.onclick

  • @Ozzz77118
    @Ozzz77118 5 років тому

    awesome.

  • @christine5906
    @christine5906 6 років тому +1

    Thanks for the tutorial but sadly the font awesome icon didn't work it showing blank square.How to fix it?

    • @OnlineTutorialsYT
      @OnlineTutorialsYT  6 років тому

      i think ur font not installed properly

    • @Apses98
      @Apses98 6 років тому

      use this and it should work

    • @masimumengi5650
      @masimumengi5650 6 років тому +1

      just remove the 's' to read and reload your page. that's if you have it on your copied link from fontawesome.com as i did.

    • @zenith5208
      @zenith5208 6 років тому

      Bro thats an older version the newer one has new classes