JSFiddle - React, Tailwind, and code Playground

JavaScript

var cScrolltop;
	var cSubpage;
	var lastDirection;
	function displaySubpage(page, direction) {
		if (cSubpage) return false;
		cScrolltop = $(window).scrollTop();
		lastDirection = direction;
		cSubpage = page;
		$('.top:first').stop().animate({
			'left': (direction === 0) ? '-100%' : '100%'
		},400);
		page.stop().animate({
			'left': '50%'
		}, 400); //speed
	}
	function hideSubpage() {
		if (!cSubpage) return false;
		$('.top:first').stop().animate({
			'left': '50%'
		}, 400);
		cSubpage.stop().animate({
			left: (lastDirection === 0) ? '100%' : '-100%'
		}, 400);
		cSubpage = null;
	}