A Pen by Claudiu Andrei on CodePen.
Created
July 1, 2020 10:55
-
-
Save andreip1/a70a9a0740373163f3072b523cbf1e27 to your computer and use it in GitHub Desktop.
Social Media Bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll("div").forEach((el) => { | |
el.addEventListener("mouseenter", function (e) { | |
e.target.querySelector("i").style.display = "inline"; | |
e.target.style.paddingTop = "15px"; | |
switch (e.target.id) { | |
case "one": | |
e.target.style.backgroundColor = "#1da1f2"; | |
break; | |
case "two": | |
e.target.style.backgroundColor = "#3b5998"; | |
break; | |
case "three": | |
e.target.style.backgroundColor = "#24292e"; | |
break; | |
case "four": | |
e.target.style.backgroundColor = "#0072b1"; | |
break; | |
case "five": | |
e.target.style.backgroundColor = "#E1306C"; | |
break; | |
case "six": | |
e.target.style.backgroundColor = "#c4302b"; | |
break; | |
} | |
}); | |
el.addEventListener("mouseleave", function (e) { | |
e.target.style.paddingTop = "0px"; | |
e.target.querySelector("i").style.display = "none"; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/fontawesome-iconpicker/3.2.0/js/fontawesome-iconpicker.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main { | |
height: 150px; | |
display: flex; | |
justify-content: center; | |
align-items: flex-end; | |
} | |
div { | |
&#one, | |
&#two, | |
&#three, | |
&#four, | |
&#five, | |
&#six { | |
height: 10px; | |
width: 50px; | |
background-color: lightgrey; | |
transition: height 0.2s; | |
text-align: center; | |
&:hover { | |
height: 50px; | |
} | |
a { | |
text-decoration: none; | |
} | |
i { | |
height: 100%; | |
display: none; | |
color: whitesmoke; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment