Created
January 25, 2019 23:08
-
-
Save parzibyte/14468721d46f8fa965e0a2fe50819c41 to your computer and use it in GitHub Desktop.
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
const cargarIconos = () => { | |
const linkIconos = document.createElement("link"); | |
linkIconos.rel = "stylesheet"; | |
linkIconos.href = "https://cdn.jsdelivr.net/npm/devicons@1.8.0/css/devicons.min.css"; | |
document.head.insertBefore(linkIconos, document.head.childNodes[document.head.childNodes.length - 1].nextSibling); | |
}; | |
const $seccionHabilidades = document.querySelector("#habilidades"); | |
const observadorIconos = new IntersectionObserver(elementos => { | |
elementos.forEach(elemento => { | |
if (elemento.intersectionRatio > 0) { | |
cargarIconos(); | |
observadorIconos.unobserve($seccionHabilidades); | |
} | |
}); | |
}); | |
observadorIconos.observe($seccionHabilidades); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment