JSFiddle - React, Tailwind, and code Playground

by Alexis López Espinoza

HTML

<section id="foo">Sección 1</section>
<section id="bar">Sección 2</section>

CSS

html, body{
	width: 100%;
	height: 100%;
}

section{
	height: 100%;
	font-size: 2rem;
}

#foo{
	background-color: yellow;
	color: red;	
}

#bar{
	background-color: red;
	color: yellow;
}

JavaScript

var bar = document.querySelector("#bar"),
	pos = bar.offsetTop;

window.scrollTo(0, pos);