window.addEventListener('mouseover', function(e) { var el = e.target; if(!el.classList.contains("screentip")) return; el = el.querySelector("span"); //... el.style.top = }, false);