JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div id="fixed-header">
User Infos
</div>
<div class="st-container">
<input type="radio" name="radio-set" checked="checked" id="st-control-1"/>
<a href="#st-panel-1">Serendipity</a>
<input type="radio" name="radio-set" id="st-control-2"/>
<a href="#st-panel-2">Happiness</a>
<input type="radio" name="radio-set" id="st-control-3"/>
<a href="#st-panel-3">Tranquillity</a>
<input type="radio" name="radio-set" id="st-control-4"/>
<a href="#st-panel-4">Positivity</a>
<input type="radio" name="radio-set" id="st-control-5"/>
<a href="#st-panel-5">Passion</a>
<div class="st-scroll">
<div class="st-panel" id="st-panel-1">
<h2>Serendipity</h2>
<p>Banksy adipisicing eiusmod banh mi sed. Squid stumptown est odd future nisi, commodo mlkshk pop-up adipisicing retro.</p>
</div >
<!--problematic section starts-->
<div id="RepresentativeRegistrationPage" class="st-panel st-color">
<form action="#" method="post" id="registration-form" novalidate="novalidate">
College:
<select class="required" id="college_id" name="college_id">
<option selected="selected" value="">Select College</option>
<option value="4">St. Xaviers College</option>
<option value="5">DMC College</option>
</select><span class="error_msg"></span><br>
First Name: <input type="text" value="" class="required" name="first_name" id="first_name"><span class="error_msg"></span><br>
Last Name: <input type="text" value=""...
CSS
#fixed-header {
position: fixed;
width: 100%;
top: 0;
height: 100px;
background: red
}
.st-container {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
font-family: 'Josefin Slab', 'Myriad Pro', Arial, sans-serif;
}
.st-container > input,
.st-container > a {
position: fixed;
bottom: 0px;
width: 20%;
cursor: pointer;
font-size: 16px;
height: 34px;
line-height: 34px;
}
.st-container > input {
opacity: 0;
z-index: 1000;
}
.st-container > a {
z-index: 10;
font-weight: 700;
background: #e23a6e;
color: #fff;
text-align: center;
text-shadow: 1px 1px 1px rgba(151,24,64,0.2);
}
/* "Fix" for percentage rounding: add a background bar pseudo element with the same color like the labels */
.st-container:before {
content: '';
position: fixed;
width: 100%;
height: 34px;
background: #e23a6e;
z-index: 9;
bottom: 0;
}
#st-control-1, #st-control-1 + a {
left: 0;
}
#st-control-2, #st-control-2 + a {
left: 20%;
}
#st-control-3, #st-control-3 + a {
left: 40%;
}
#st-control-4, #st-control-4 + a {
left: 60%;
}
#st-control-5, #st-control-5 + a {
left: 80%;
}
.st-container > input:checked + a,
.st-container > input:checked:hover + a{
background: #821134;
}
.st-container > input:checked + a:after,
.st-container > input:checked:hover + a:after{
bottom: 100%;
border: solid transparent;
content: '';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-bottom-color: #821134;
border-width: 20px;
left: 50%;
margin-left: -20px;
}
.st-container > input:hover + a{
background: #AD244F;
}
.st-container > input:hover + a:after {
border-bottom-color: #AD244F;
}
.st-scroll,
.st-panel {
position: relative;
width: 100%;
height: 100%;
}
.st-scroll {
top: 0;
left: 0;
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all...
JavaScript
var tabs = document.getElementById("registration-form").elements;
for (var i = 0; i < tabs.length; i++) {
tabs[i].setAttribute("tabindex", i + 1);
tabs[i].addEventListener('keydown', function(e) {
var e = window.event || e;
var keyCode = e.keyCode || e.which;
if (keyCode == 9) {
e.preventDefault();
var x = window.scrollX,
y = window.scrollY;
var elementToFocus = document.getElementById("registration-form").elements[this.getAttribute("tabindex")];
if (typeof elementToFocus == "undefined") {
elementToFocus = document.getElementById("registration-form").elements[0];
}
elementToFocus.focus();
window.scrollTo(x, y);
}
});
}
window.addEventListener("scroll", function(e) {
var e = window.event || e;
e.preventDefault();
window.scrollTo(0, 0);
});