From e9cfc4c35f9904cf1ac3a1fabcd8ec865091307b Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sun, 14 Aug 2022 17:31:55 +0200 Subject: CV head animation with flipping on X axis --- template/_includes.html | 2 +- template/script.js | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'template') diff --git a/template/_includes.html b/template/_includes.html index 6615ff2..5151355 100755 --- a/template/_includes.html +++ b/template/_includes.html @@ -1,6 +1,6 @@ - + diff --git a/template/script.js b/template/script.js index 796ea4f..c03883f 100755 --- a/template/script.js +++ b/template/script.js @@ -3,13 +3,9 @@ window.addEventListener('load', async () => { // flip CV image on mouse over const cvImage = document.querySelector('.cv-picture img'); if (cvImage) { - cvImage.addEventListener('mouseover', evt => { - evt.target.style.transform = 'scaleX(-1)'; - }); - - cvImage.addEventListener('mouseout', evt => { - evt.target.style.transform = 'scaleX(1)'; - }); + setInterval(() => { + cvImage.style.transform = cvImage.style.transform === 'scaleX(1)' ? 'scaleX(-1)' : 'scaleX(1)'; + }, 1000); } }); -- cgit v1.2.3