+ 1
animation and event handling
i have a form which when submitted, an animation starts of some duration(say 10s).... after the animation ends, i want an alert message to be displayed... how can i do that? (i cannot use setTimeout because I'll not know how much time will the user take to submit the form....)
7 ответов
+ 3
You can use setTimeout. After exactly ten seconds after the button is pressed, you will get an alert. https://code.sololearn.com/WEr7TbRsGmcZ/?ref=app
+ 2
thanks Jax and 🌴Vincent Berger🌴 for your help... that really helped a lot 👍👍
+ 1
Hi Ravindra Desai,
Just use an if .. else stament that make the decision against the required input. 😊
Or,
You can use an event listener to detect change or focus on the input tag.
F.E. the client inserted the data to the input and when the client loses focus or changing focus to another HTML element then you can execute a code block based on that action.
Have a look at this snippet👍😊
https://code.sololearn.com/WEGb3Ng2x9ki/?ref=app
+ 1
Jax and 🌴Vincent Berger🌴 ...another help required 😅... i want an audio to play using javascript..
fr ex.. https://www.zedge.net/ringtone/6bf8b324-a3c7-34d8-ab6b-e915a6894308?utm_source=zedgeWeb&utm_medium=uploaderProfile&utm_campaign=sharing
that link has an audio file.. how can i play that audio file as soon as a page loads(or any other event occurs using only javascript ) ??
+ 1
Ravindra Desai,
Download the file and upload it to your dropbox:
https://www.sololearn.com/discuss/1054246/?ref=app
Declare a new js audio object and give the source method your link.
//_
var audio = new Audio();
audio.src("your_link");
audio.play;
when playing audio via JS, you need a users gesture for initialization.
https://www.w3schools.com/jsref/dom_obj_audio.asp
+ 1
Ravindra Desai,
Have a look at this snippet👍😊
https://code.sololearn.com/WNHmRWXj854E/?ref=app
0
🌴Vincent Berger🌴
thanks.. it worked!!
is there a way to play that audio twice continuously?