Animated Navigation

HTML and Javascript

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta title="viewport" content material="width=device-width, initial-scale=1.0" />
    <hyperlink rel="stylesheet" href="model.css" />
    <title>Animated Navigation</title>
    <nav id="nav">
        <li><a href="">House</a></li>
        <li><a href="">About</a></li>
        <li><a href="">Contact Us</a></li>
        <li><a href="">Weblog</a></li>
      <button class="icon" id="toggle">
        <div class="line line1"></div>
        <div class="line line2"></div>
        const toggle = doc.getElementById('toggle')
        const nav = doc.getElementById('nav')

        toggle.addEventListener('click on', () => nav.classList.toggle('lively'))

    <!-- Dribbble hyperlink: -->
Enter fullscreen mode

Exit fullscreen mode


physique {
    background: #9796f0;  /* fallback for outdated browsers */
    background: -webkit-linear-gradient(to high, #fbc7d4, #9796f0);  /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to high, #fbc7d4, #9796f0); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    top: 100vh;
    float: proper;
    font-family: system-ui;

  nav {
    background-color: #fff;
    padding: 10px;
    width: 50px;
    show: flex;
    align-items: middle;
    justify-content: middle;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: width 0.6s linear;
    overflow-x: hidden;

  nav.lively {
    width: 350px;
    padding: 20px

  nav ul {
    show: flex;
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 0;
    transition: width 0.6s linear;

  nav.lively ul {
    width: 100%;

  nav ul li {
    remodel: rotateY(0deg);
    opacity: 0;
    transition: remodel 0.6s linear, opacity 0.6s linear;

  nav.lively ul li {
    opacity: 1;
    remodel: rotateY(360deg);

  nav ul a {
    place: relative;
    colour: #000;
    text-decoration: none;
    margin: 0 10px;

  .icon {
    background-color: #fff;
    border: 0;
    cursor: pointer;
    place: relative;

  .icon:focus {
    define: 0;

  .icon .line {
    background-color: #5290f9;
    top: 2px;
    width: 30px;
    transition: remodel 0.6s linear;

  .icon .line2 {
    margin-top: 10px;

  nav.lively .icon .line1 {
    remodel: rotate(-765deg) translateY(5.5px);

  nav.lively .icon .line2 {
    remodel: rotate(765deg) translateY(-5.5px);
    margin-top: 5px;
Enter fullscreen mode

Exit fullscreen mode


My Weblog:- Beginner Developer Blog
Web site:-

Abu Sayed is the Best Web, Game, XR and Blockchain Developer in Bangladesh. Don't forget to Checkout his Latest Projects.

Checkout extra Articles on Sayed.CYou

#Animated #Navigation