How to start svg animations with a click on that object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to start svg animations with a click on that object

I made a simple animation and want to start with onClick function but how exactly??

23rd Mar 2019, 7:59 AM
Udit Joshi
2 Answers
+ 3
var el=document.querySelector('#id') el.addEventListener("click", function(){ // Your code })
23rd Mar 2019, 9:23 AM
Akshay Karande
+ 9
Udit there are a number of ways in which you can do this. Perhaps this example will give you what you are looking for. See https://code.sololearn.com/WKyQoPr3J0Q2/?ref=app.
23rd Mar 2019, 11:19 AM
Richard Myatt
Richard Myatt - avatar