Skip to content

Instantly share code, notes, and snippets.

@ofmarconi
Last active June 19, 2022 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ofmarconi/fa53493cf1f5fbabfab7865d84271acc to your computer and use it in GitHub Desktop.
Save ofmarconi/fa53493cf1f5fbabfab7865d84271acc to your computer and use it in GitHub Desktop.
inside each .item when mouse hovers over element .trigger add .open class to .triggered element inside each .item when mouse moves over element .trigger remove .open class to .triggered element (by askjarvis.io)
var acionadores = document.querySelectorAll('.item .acionador');
for (var i = 0; i < acionadores.length; i++) {
acionadores[i].addEventListener('mouseover', function() {
this.parentNode.querySelector('.acionado').classList.add('aberto');
});
acionadores[i].addEventListener('mouseout', function() {
this.parentNode.querySelector('.acionado').classList.remove('aberto');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment