@carlosfrontend/dropdownme
v1.0.2
Published
A lightweight and simple dropdown generator
Downloads
1
Maintainers
Readme
@carlosfrontend/dropdownme
Dynamic User Interface Interactions
JavaScript Course The Odin Project
This package was developed as an exercise for The Odin Project. It's pretty lightweight and allows you to add as many animated dropdown menus as you need.
HTML
The first thing you need is to copy and paste this codeblock container into your body tags:
index.html
<body> <nav id="navbar"> <!-- Dropdonws will goes here --> </nav> </body>
Each block with the
.parentContainer
class is a dropdown menu. You can add by copying and pasting as many as you need at you navbar container:index.html
<nav id="navbar"> <!-- Start of the first dropdown --> <div class="parentContainer"> <div class="parentItem">Home</div> <div class="itemsContainer"> <div class="dummy-item"></div> <div class="item">One</div> <div class="item">Two</div> <div class="item">Three</div> </div> </div> <!-- End of the first dropdown --> <!-- Start of the second dropdown --> <div class="parentContainer"> <div class="parentItem">Services</div> <div class="itemsContainer"> <div class="dummy-item"></div> <div class="item">One</div> <div class="item">Two</div> <div class="item">Three</div> <div class="item">Four</div> </div> </div> <!-- End of the second dropdown --> </nav>
Advice
The only requirement is not to change the name of the nav id and the name classes. You can replace the rest of the text with whatever you want. You can even add more tags with the html tag if you need more elements:
<div class="item">New Item</div>
Javascipt
Install it as a dependency in your project with this terminal command:
npm i @carlosfrontend/dropdownme
Make sure you import it into your project's javascipt file and call the function to animate the dropdown:
index.js
import dropDownMe from "@carlosfrontend/dropdownme"; dropDownMe();
Link:
:white_check_mark: Assigments :blue_book:
:white_check_mark: Live Preview :computer:
Feel free to change the styles as you like.
Happy Coding!! :coffee: :rocket: