I`m using this code to create an animation of moving text i ASP.NET Core project .cfm How do I execute js sctipt after animation is finished? Something like that, I want to refresh page after animation is finished
<script>
function myFunction() {
location.reload();
}
</script>
I`m using this code to create an animation of moving text i ASP.NET Core project http://www.html.am/html-codes/marquees/css-scrolling-text.cfm How do I execute js sctipt after animation is finished? Something like that, I want to refresh page after animation is finished
<script>
function myFunction() {
location.reload();
}
</script>
Share
Improve this question
asked Jun 7, 2018 at 13:11
IntegerOverlordIntegerOverlord
1,6373 gold badges18 silver badges38 bronze badges
2
- try using js animation. – Ullas Hunka Commented Jun 7, 2018 at 13:18
- this may help davidwalsh.name/css-animation-callback – Alex Terry Commented Jun 7, 2018 at 13:36
1 Answer
Reset to default 17All you really need to do is create a Javascript event listener:
The example below creates an event listener for the circle object. You can run the example to see it live.
Also, all of the CSS / circle stuff is just for the animation, all you really need to look at is the javascript portion.
var circle = document.getElementsByTagName("circle")[0];
var change = document.getElementById("change");
circle.addEventListener("animationend", function() {
change.innerHTML = "The animation has ended!";
});
circle {
border-radius: 50%;
width: 100px;
height: 100px;
background-color: rgba(0,0,255,0.9);
border: 2px solid black;
position: absolute;
animation: bounce 1.5s;
animation-direction: alternate;
animation-timing-function: cubic-bezier(.5,0.05,1,.5);
animation-fill-mode: forwards;
}
@keyframes bounce {
from {
transform: translate3d(0, 0, 0);
}
to {
transform: translate3d(0, 200px, 0);
}
}
<p id='change'>
This text will change when the animation has ended.
</p>
<circle></circle>