I have 2 problems, what I'm doing is not working, if I put overflow = hidden
and it works if I move from one to two, but two to one does not work, it gets caught.
Let's see if you can lend me a hand
$(document).ready(function() {
/******** Desplazamiento vertical ********/
$(function () {
var $win = $(window);
var $pos = $(window).height();
var uno = $(".uno").offset().top;
var dos = $(".dos").offset().top;
$win.scroll(function () {
if ($win.scrollTop() <= $pos) {
$("html, body").animate({
scrollTop: dos
}, 2000);
}
else {
$("html, body").animate({
scrollTop: uno
}, 2000);
}
});
});
/******** ********/
});
.uno {
background-color: blue;
top: 0;
left: 0;
width: auto;
height: 100vh;
}
.dos {
background-color: red;
top: 0;
left: 0;
width: auto;
height: 100vh;
}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<main>
<section class="uno">
</section>
<section class="dos">
</section>
</body>
</html>