my goal is to stop a div from scrolling that has a position: fixed in the center of section two. I have found some answers, but they use jQuery. Is there a way to achieve this in JavaScript or CSS without jQuery? Thanks in advance.
section{
height: 100vh;
overflow: hidden;
}
.one{
background-color: greenyellow;
}
.two{
background-color: red;
}
.three{
background-color: aqua;
}
.parent{
width: 100vw;
height: 100vh;
display: flex;
justify-content: center ;
align-items: center;
}
.square{
width: 100px;
height: 100px;
background-color:blue;
position: fixed;
}
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Stop-Scroll</title>
<link rel="stylesheet" href="style.css">
<body>
<section class="one">
<div class="parent">
<div class="square"></div>
</div>
</section>
<section class="two">
</section>
<section class="three">
</section>
<script src="script.js"></script>
</body>
</html>