I have written some Javascript to try and enlarge my list of anchors text when they are hovered over the text increases in size and when they are not beng hovered over they revert to normal size.
Do I need a seperate class with an animation back to regular size? and what is making the code go so wrong?
const numHeaderAnchors = 5;
const numFooterAnchors = 3;
var anchorsAll = document.getElementsByTagName("a");
var anchorsInList = [];
var count = 0;
for(var i = numHeaderAnchors; i < document.anchors.length - numFooterAnchors; i++){
anchorsInList[count] = anchorsAll.item(i);
console.log(anchorsInList[count].text);
count++;
}
function zoomLetters(numAnchor){
anchorsInList[numAnchor].classList.add("zoom");
}
function deZoomLetters(numAnchor){
anchorsInList[numAnchor].classList.remove("zoom")
}
for(var i = 0; i < anchorsInList.length;i++){
anchorsInList[i].addEventListener(onmouseover, zoomLetters(i));
anchorsInList[i].addEventListener(onmouseout, deZoomLetters(i));
}
here is my css transition class.
.zoom {
-webkit-transition: 1s;
-moz-transition: 1s;
-ms-transition: 1s;
-o-transition: 1s;
transition: 1s;
font-size: 3em;
}
Thanks for the help!