JSFiddle - React, Tailwind, and code Playground

HTML

<div id="1">1</div>
<div id="2">2</div>
<div id="hello"></div>
<script>load()</script>

JavaScript

function load(){
			$("#login").hide();
            $("#2").hide();
			setInterval(next, 2000);
		}
        function next(){
            //Make it only set var once
            var y;
            if(y !== 0){
                var i=1; y=0;
            }
            $('#hello').append('i' + i + ' : ');
            //Work out next box
            var x;
			if (i == 2)
                x=1;
            else
                x=i+1;
            //Slide old content up
			$("#" + i ).slideUp();
            //SET next box
            i=x;
            //Slide next box into place
  			$("#" + i ).slideDown();
            //Deubgging
            $('#hello').append('x2' + x);
            $('#hello').append(', i2' + i + ' : ');
		}