diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2022-08-14 17:31:55 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2022-08-14 17:31:55 +0200 |
| commit | e9cfc4c35f9904cf1ac3a1fabcd8ec865091307b (patch) | |
| tree | afdc2d81a7e2e9192d7d14dac2c6cc0cc5cc7673 /template | |
| parent | decde989ff7614dc109af1fb42559ff4814ffc7c (diff) | |
| download | mitjafelicijan.com-e9cfc4c35f9904cf1ac3a1fabcd8ec865091307b.tar.gz | |
CV head animation with flipping on X axis
Diffstat (limited to 'template')
| -rwxr-xr-x | template/_includes.html | 2 | ||||
| -rwxr-xr-x | template/script.js | 10 |
2 files changed, 4 insertions, 8 deletions
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 @@ | |||
| 1 | <!-- user code --> | 1 | <!-- user code --> |
| 2 | 2 | ||
| 3 | <script src="/script.js?v=2022-07-22-02" async></script> | 3 | <script src="/script.js?v=2022-08-14-02" async></script> |
| 4 | 4 | ||
| 5 | <!-- Fathom - beautiful, simple website analytics --> | 5 | <!-- Fathom - beautiful, simple website analytics --> |
| 6 | <script src="https://cdn.usefathom.com/script.js" data-site="XHQARKXP" defer></script> | 6 | <script src="https://cdn.usefathom.com/script.js" data-site="XHQARKXP" defer></script> |
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 () => { | |||
| 3 | // flip CV image on mouse over | 3 | // flip CV image on mouse over |
| 4 | const cvImage = document.querySelector('.cv-picture img'); | 4 | const cvImage = document.querySelector('.cv-picture img'); |
| 5 | if (cvImage) { | 5 | if (cvImage) { |
| 6 | cvImage.addEventListener('mouseover', evt => { | 6 | setInterval(() => { |
| 7 | evt.target.style.transform = 'scaleX(-1)'; | 7 | cvImage.style.transform = cvImage.style.transform === 'scaleX(1)' ? 'scaleX(-1)' : 'scaleX(1)'; |
| 8 | }); | 8 | }, 1000); |
| 9 | |||
| 10 | cvImage.addEventListener('mouseout', evt => { | ||
| 11 | evt.target.style.transform = 'scaleX(1)'; | ||
| 12 | }); | ||
| 13 | } | 9 | } |
| 14 | 10 | ||
| 15 | }); | 11 | }); |
