dynamic-dropdown-cssstyled
v1.1.4
Published
add dropdown element to DOM dynamically with CSS animations
Downloads
3
Maintainers
Readme
$ npm i dynamic-dropdown-cssstyled
<!-- index.html -->
<nav>
<div>
<button id='addDropDown'>DropDown</button>
</div>
<div>
<button id='addAnotherDropDown'>Another One</button>
</div>
</nav>
// src/index.js
import addDropDown from "dynamic-dropdown-cssstyled";
addDropDown(
elementToAddID, // ID of HTML element to add dropDown to
backgroundColor, // Color for dropDown background
fontColor, // Color for dropDown text
contentToAdd // Array of objects containing link for href as well as textContent for anchor tag
)
addDropDown("addDropDown", "#c8c6c6", "#4b6587", [
{
link: "http://www.google.com/",
text: "Google",
},
{
link: "https://github.com/Ishmam156",
text: "My GitHub",
},
]);
addDropDown("addAnotherDropDown", "pink", "purple", [
{
link: "http://www.google.com/",
text: "Google",
},
]);