JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrapper">
<div id="page1" class="page" style="background-color: #FF9999;">
<h1>page1</h1>
<button class="buttonNext">next</button>
</div>
<div id="page2" class="page" style="background-color: #00ff00;">
<h1>page2</h1>
<button class="buttonNext">next</button>
<button class="buttonPrevious">previous</button>
</div>
<div id="page3" class="page" style="background-color: #0000ff;">
<h1>page3</h1>
<button class="buttonPrevious">previous</button>
</div>
</div>
CSS
html{
margin: 0;
padding: 0;
border: 0;
width: 100%;
height: 100%;
}
#wrapper{
background-color: #000000;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
}
.page{
width: 100%;
height: 100%;
position: absolute;
top: 0;
overflow: hidden;
backface-visibility: hidden;
}
#page1 {
left: 0;
}
#page2 {
left: 100%;
}
#page3{
left: 200%;
}
JavaScript
$(document).ready(function(){
$('.buttonNext').click(function(){
$('.page').animate({'left': '-=100%'}, 500 );
});
$('.buttonPrevious').click(function(){
$('.page').animate({'left': '+=100%'}, 500 );
});
});