JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
</head>
<body>
<main>
<section>
<form action=submit method=post>
<fieldset>
<legend>Enter Your Details</legend>
<label>Email<br><input id="emailone" type=email name=email placeholder=jane@example.com></label><hr>
<label>Message<br><textarea name=briefing placeholder="Lorem ipsum dolor sit amet."></textarea></label><hr>
<input type=submit value=Submit>
</fieldset>
</form>
</section>
<section>
<h2>Second Page</h2>
</section>
<form action=submit method=post>
<fieldset>
<legend>Enter Your Details</legend>
<label>Email<br><input id="emailtwo" type=email name=email placeholder=jane@example.com></label><hr>
<label>Message<br><textarea name=briefing placeholder="Lorem ipsum dolor sit amet."></textarea></label><hr>
<input type=submit value=Submit>
</fieldset>
</form>
</main>
</body>
</html>
CSS
html { height: 100% }
html, body, main, section {
display: flex;
flex-grow: 1
}
main { flex-direction: column }
section {
justify-content: center;
align-items: center;
flex: 1 0 100%
}
JavaScript
var intersectionObserver = new IntersectionObserver(function(entries) {
// If intersectionRatio is 0, the target is out of view
// and we do not need to do anything.
if (entries[0].intersectionRatio <= 0){
console.log("the field is not visible");
}else{
console.log("the field is visible")
}
});
// start observing
intersectionObserver.observe(document.querySelector('#emailtwo'));