Sticky Navigation Bar On Scroll Using Vanilla Javascript

Sticky Navigation Bar On Scroll Using Vanilla Javascript

CodingBD given here Sticky Navigation Bar On Scroll Using Vanilla Javascript . We created a vanilla JavaScript Sticky Nav. It is the most important part Of Sticky Navigation Bar. We have given more importance to javascript effects. We have used pure javascript. They used pure css tutorials because they need highly effective effects. Thank you so much.

Sticky Navigation Bar On Scroll Using Vanilla Javascript

😍😍 If You like this video Please like, share and subscribe This video.😍😍 

😍😍 Check Others Programming Video👇

➡️ How to create responsive wall Photo Frame:   

➡️ CSS 3d Layered Image Hover Effects CSS: 

➡️Responsive website html css javascript | part( 1 ):… 

➡️ Responsive Services Section:…

➡️ CSS Clip Path Hover Circle Hover Effects:…

➡️ CSS Responsive CARD Hover Effects & Adding Stroke to Text | Html5 CSS3 2021:…

➡️  Neon Light Button Animation Effects on Hover | CSS Snake Border:… 

➡️ Responsive Box Model Web Design Using CSS Flexbox:… 

➡️ Digital Clock with Animated Progress-bar | HTML CSS & Vanilla Javascript:… 

➡️ How to create a light to dark mode for HTML CSS & Vanilla Javascript 2021:…  

➡️Scroll top button :… 
➡️ Animated eid mubarak 2021 using Html CSS & Javascript:…

Here is all Source code. You can follow this steps:

  1. Create 1 folder
  2. create 1 HTML file: index.html
  3. create 1 CSS file: style.css
  4. Download Images
  5. copy HTML code and pest HTML file, copy CSS code and past CSS file
  6. Now give a smile and jump out loud. 😍😍
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sticky navbar</title>
    <!--================================ bootstrapCdn link====================== -->

    <link rel="stylesheet" href=""
        integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

    <link rel="stylesheet" href="style.css">

        <nav id="navItem" class="navbar navbar-expand-lg navbar-light ">
            <a class="navLogo">Coding BD</a>

            <div class="collapse navItem navbar-collapse">
                <ul class="navbar-nav ml-auto navItem  d-flex align-items-center">
                    <li class="nav-item">
                        <a class="nav-link">Home</a>
                    <li class="nav-item">
                        <a class="nav-link">About Us</a>
                    <li class="nav-item">
                        <a class="nav-link">Protfolio</a>
                    <li class="nav-item">
                        <a class="nav-link">Skill</a>
                    <li class="nav-item">
                        <a class="nav-link">Contact</a>
        const header = document.querySelector('header');
        window.addEventListener('scroll', () => {
            header.classList.toggle('sticky', window.pageYOffset > 0);


@import url("[email protected];500;600;700&display=swap");
* {
    margin: 0;
    padding: 0;
    font-family: "Poppins", sans-serif;
    text-decoration: none;

body {
    background: #ddd;
    width: 100%;
    height: 140vh;

/* =========================================nav bar================================ */

header {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 111000;
    transition: 0.7s;
    -webkit-transition: 0.7s;
    -moz-transition: 0.7s;
    -ms-transition: 0.7s;
    -o-transition: 0.7s;

.sticky {
    background: #ffffff;
    color: #000;
    animation: fixedHeader 0.8s ease;
    -webkit-animation: fixedHeader 0.8s ease;

@keyframes fixedHeader {
    0% {
        transform: translateY(-100%);
        -webkit-transform: translateY(-100%);
        -moz-transform: translateY(-100%);
        -ms-transform: translateY(-100%);
        -o-transform: translateY(-100%);
    100% {
        transform: translateY(-0%);
        -webkit-transform: translateY(-0%);
        -moz-transform: translateY(-0%);
        -ms-transform: translateY(-0%);
        -o-transform: translateY(-0%);

.sticky .navItem li a {
    color: #000;

.navLogo {
    margin-left: 44px;
    line-height: 70px;
    font-size: 25px;
    color: #000;
    z-index: 8;

.navItem li {
    display: block;
    line-height: 70px;
    margin-right: 40px;
    font-size: 20px;
    position: relative;
    z-index: 1000;
    text-decoration: none;
.navItem li a {
    color: #000;
    transition: 0.5s;
    -webkit-transition: 0.5s;
    -moz-transition: 0.5s;
    -ms-transition: 0.5s;
    -o-transition: 0.5s;

/* =========================================nav bar================================ */

Don’t Forget to Follow me on all Social Network,


Facebook Page: Coding BD –



Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *