Tuesday, 4 April 2017

How to change three classes one by one continuously

<script>
    $(document).ready(function(){      
        function show_first(){
            $("#Fire").addClass("fire1");
            $("#Fire").removeClass("fire0");
            setTimeout(show_second,50);
        }
        function show_second(){
            $("#Fire").addClass("fire2");
            $("#Fire").removeClass("fire1");
            setTimeout(show_third,50);
        }
        function show_third(){
            $("#Fire").addClass("fire0");
            $("#Fire").removeClass("fire2");
            setTimeout(show_first,50);
        }
        setTimeout(show_first,50);
    });
</script>

No comments:

Post a Comment