HTML CSS & JAVASCRIPT, YouTube

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: https://www.youtube.com/watch?v=aT6QLrfO_oU   

➡️ CSS 3d Layered Image Hover Effects CSS: https://www.youtube.com/watch?v=0qdWV7-Oi6k&t=66s 

➡️Responsive website html css javascript | part( 1 ): https://www.youtube.com/watch?v=g0ART… 

➡️ Responsive Services Section: https://www.youtube.com/watch?v=wvLky…

➡️ CSS Clip Path Hover Circle Hover Effects: https://www.youtube.com/watch?v=cRSgo…

➡️ CSS Responsive CARD Hover Effects & Adding Stroke to Text | Html5 CSS3 2021: https://www.youtube.com/watch?v=QVMJ5…

➡️  Neon Light Button Animation Effects on Hover | CSS Snake Border: https://www.youtube.com/watch?v=GtVSF… 

➡️ Responsive Box Model Web Design Using CSS Flexbox: https://www.youtube.com/watch?v=03RuV… 

➡️ Digital Clock with Animated Progress-bar | HTML CSS & Vanilla Javascript: https://www.youtube.com/watch?v=6A6Hp… 

➡️ How to create a light to dark mode for HTML CSS & Vanilla Javascript 2021: https://www.youtube.com/watch?v=43FbR…  

➡️Scroll top button : https://www.youtube.com/watch?v=9fDEJ… 
➡️ Animated eid mubarak 2021 using Html CSS & Javascript: https://www.youtube.com/watch?v=60H2g…

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">

<head>
    <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="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
        integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">

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

<body>
    <header>
        <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>
                    <li class="nav-item">
                        <a class="nav-link">About Us</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link">Protfolio</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link">Skill</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link">Contact</a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <script>
        const header = document.querySelector('header');
        window.addEventListener('scroll', () => {
            header.classList.toggle('sticky', window.pageYOffset > 0);
        });

    </script>
</body>

</html>
@import url("https://fonts.googleapis.com/css2?family=Poppins:[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;
}
a:hover{
    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,

YouTube: https://www.youtube.com/channel/UCw9etYfx-25oKB_qt1fFNWw

Facebook Page: Coding BD – https://www.facebook.com/codingbd2021

LinkedIn: https://www.linkedin.com/in/sajjat-hossain-0617961b1

GitHub: https://github.com/cgsaleh8383

Related Posts

Leave a Reply

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