Yo ninjas, in this responsive design tutorial, I’m gonna show you how to make a simple but effective drop-down mobile navigation using just CSS and a little jQuery.

jQuery – http://code.jquery.com/jquery-1.11.3.min.js

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET

========== CSS for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gQeDH6xYhmO-db2mhoTSrT

========== HTML for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9ibZ2TSBaGGNrgh4ZgYE6Cc

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

========== Social Links ==========

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

source

41 Comments

  1. YOU have absolutely no idea how happy am I. I was doing this my whole day searching it on W3S, StackOverflow…nothing. I was searching for the burger menu button, that opened links for smaller sreen size and that it didnt disturb larger sizes. Unfortulately nothing worked untill you showed us. THANK YOU FROM THE BOOTOM OF MY HEART!!!

  2. 8:20 no need to copy those changes to the file manually. You could've saved them through the browser.
    Look at the file name style.css in the Sources tab, it has that asterisk sign * at the beginning / end of the file name.

  3. For those without image:

    html: <div class="burguer-nav">
    <div class="btn">
    <div class="btn-line"></div>
    <div class="btn-line"></div>
    <div class="btn-line"></div>
    </div>
    </div>

    css:

    .burguer-nav {
    height: 40px;
    width: 100%;
    background-color: #404040;
    padding: 10px 0 0 0;
    }

    .btn {
    cursor: pointer;
    width: 30px;
    float: right;
    padding-right: 10px;
    }

    .btn.open .btn-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    }

    .btn.open .btn-line:nth-child(2) {
    opacity: 0;
    }

    .btn.open .btn-line:nth-child(3) {
    transform: rotate(135deg) translate(-6px, 6px);
    }

    .btn-line {
    width: 28px;
    height: 3px;
    margin: 5px 0 0 0;
    background: #fff;
    transition: all 0.5s;
    }

    header nav ul {
    width: 100%;
    background-color: #444;
    display: none;
    }

    header nav ul.open {
    display: block;
    }

    header nav ul li {
    width: 100%;
    float: none;
    margin: 0 auto;
    padding: 5px;
    }

    header nav ul li a {
    color: #fff;
    }
     
    js

    const btn = document.querySelector('.btn');
    const ul = document.querySelector('header nav ul');

    btn.addEventListener('click', () => {
    ul.classList.toggle('open');
    btn.classList.toggle('open');
    });

  4. I literally have to say by far this is the most simple, well explained, and well taught tutorial ever watched.  I have watched literally 20 different tutorials and neither could help me properly.  I was able to follow this one and was able to achieve what I was attempting to do.  I am still a rookie in the land of JavaScript and jQuery, but I was definitely able to follow this and do what I was trying to accomplish.  Thank you for this video.

  5. Thank you so much! I literally can't thank enough. I have searched for this kind of video for AGES, and finally, I found one that explained it good enough for me to understand (I'm very bad at HTML/CSS/JavaScript). Just subbed and liked!

  6. Hello! I love your tutorials but just not sure why we have to use jquery here? I am wondering if you can help me with my navigation menu? I have been following another tutorial but don't like my responsive design that much and would like to change the layout

  7. Hi, I would really appreciate if you can answer this question. Is there any way I can do this without collapsing/pushing the image below? Like I want the menu to expand on top of the image. I played around with "height:auto;" on open class, but I do not know where to start from there. Thank you as always.

  8. Hello! I put the css and JavaScript code in for making the interactive menu with burger icon but it's not showing up on my site… Maybe I don't have my html css ajd JavaScript files connected or referenced right? PLEASE HELP ME! : )

  9. The way I had mine set up didn't work with the tags "header nav ul" I had a primary and secondary header. I had to use class names I had assigned to the navigations. Thanks, your video was so helpful!

Leave A Reply

Please enter your comment!
Please enter your name here