Jump to content

I would like the animation to loop steady


Recommended Posts

Hello folks, below is my code and I would like the animation to loop continuously once click


<div class="w3-container w3-center">
    <p id="Demo">Animation is Fun!</p>
    <button class="w3-bar-item w3-green " type="button" onclick="myFunction()" class="w3-button">Touch me</button>
                        <p>The w3-animate-top class slides in an element from the top.</p>

function myFunction() {
    var x = document.getElementById("Demo");
    if (x.className.indexOf("w3-animate-top") == -1) {
        x.className += " w3-animate-top";
    } else {
        x.className = x.className.animate(" w3-animate-top", "");

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...