+ 2

How to start a SVG animation with a click of a button?

this SVG animation : https://code.sololearn.com/WvdziSo2e72X/?ref=app

15th Jun 2018, 9:45 AM
Eli Ben Shimon
Eli Ben Shimon - avatar
1 Respuesta
0
Thats one dirty way to do so : <script> document.querySelector('.first').addEventListener('click', function() { var elements = document.querySelectorAll('animate'); var repeat = 150; if (elements[0].getAttribute('repeatCount') != 0) { repeat = 0; } for (var i = 0; i < elements.length; i++) { elements[i].setAttribute('repeatCount', repeat); } }, false); </script> Click on your name to start/stop the animation
15th Jun 2018, 2:12 PM
spotbot2k
spotbot2k - avatar