I add the button refresh on the page, so it resets the tic tac toe game.
But instead of rotating it starts to rotate and stops immediately.
As far as I get it, refresh1.classList.add("fa-spin"); add the class to an element and after that the page reloads.
A link to the whole page is here
https://codepen.io/Y-Taras/pen/rrkKWz
An abstract of code concerned with this question:
var reset = document.getElementsByClassName('hard-reset')[0];
reset.addEventListener('click', resetAll);
...
function hideFooter() {
for (i = 0; i < tableElem.length; i++) {
tableElem[i].innerHTML = "";
tableElem[i].className = "";
}
footer.className = "hide";
}
function resetAll() {
board = ['e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e'];
hideFooter();
var refresh1 = document.getElementById("refresh");
refresh1.classList.add("fa-spin");}
HTML part:
<button class="hard-reset">
<i id="refresh" class="fa fa-refresh fa-2x"></i>
</button>