Dropdown Menu Animation

Size
3,411 Kb
Views
68,816

How do I make an dropdown menu animation?

Fancy, little animation for a dropdown menu or list. Using CSS3 animations and jQuery.. What is a dropdown menu animation? How do you make a dropdown menu animation? This script and codes were developed by Karsten Buckstegge on 10 September 2022, Saturday.

Dropdown Menu Animation Previews

Dropdown Menu Animation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Dropdown Menu Animation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <html lang="en">
<head> <meta charset="UTF-8" /> <title>Drop Menu</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
</head>
<body> <p class="commander">Click the Button!</p> <div class="wrapper"> <div class="menu"> <ul class="menu__list"> <li class="menu__list__item"><a href="#">Home</a></li> <li class="menu__list__item"><a href="#">Portfolio</a></li> <li class="menu__list__item"><a href="#">About</a></li> </ul> </div> <div class="button"> <span class="button__line"></span> <span class="button__line"></span> <span class="button__line"></span> </div> </div>
</body>
</html> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Dropdown Menu Animation - Script Codes CSS Codes

@-webkit-keyframes drop { from { top: 0px; } 70% { top: 165px; -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { top: 150px; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
}
@keyframes drop { from { top: 0px; } 70% { top: 165px; -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { top: 150px; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
}
html { width: 100%; height: 100%; background: -webkit-radial-gradient(center, #ffffff 0%, #cccccc 70%, #cccccc 100%) no-repeat; background: radial-gradient(center, #ffffff 0%, #cccccc 70%, #cccccc 100%) no-repeat;
}
body { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap;
}
.commander { width: 100%; color: #2E3F47; font-size: 1.5em; font-family: 'Open Sans', sans-serif; text-align: center;
}
.wrapper { position: relative; width: 150px; height: 150px; margin: 10px auto;
}
.button { display: -webkit-box; display: -ms-flexbox; display: flex; position: absolute; top: 0; width: 100%; height: 100%; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; border-radius: 50%; background: #2E3F47; z-index: 2;
}
.button__line { background: #ccc; width: 90px; height: 15px;
}
.button__line:not(:first-child) { margin-top: 15px;
}
.menu { width: 100%;
}
.menu__list { text-align: center; width: 100%; padding-left: 0;
}
.menu__list__item { position: relative; list-style: none; padding-bottom: 15px; top: 0px;
}
.menu__list__item a { text-decoration: none; color: grey; text-align: center; font-size: 1.5em; font-family: 'Open Sans', sans-serif;
}
.menu__list__item { opacity: 0;
}
.menu__list--animate .menu__list__item { -webkit-animation: drop 0.9s; animation: drop 0.9s; -webkit-animation-fill-mode: forwards; animation-fill-mode: forwards; opacity: 1;
}
.menu__list--animate .menu__list__item:nth-child(2) { -webkit-animation-delay: 0.5s; animation-delay: 0.5s;
}
.menu__list--animate .menu__list__item:nth-child(3) { -webkit-animation-delay: 1s; animation-delay: 1s;
}

Dropdown Menu Animation - Script Codes JS Codes

// function to trigger animation
document.querySelector('.button').addEventListener('click', () => { document.querySelector('.menu__list') .classList.toggle('menu__list--animate');
});
Dropdown Menu Animation - Script Codes
Dropdown Menu Animation - Script Codes
Home Page Home
Developer Karsten Buckstegge
Username MrBambule
Uploaded September 10, 2022
Rating 4.5
Size 3,411 Kb
Views 68,816
Do you need developer help for Dropdown Menu Animation?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Karsten Buckstegge (MrBambule) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!