사용자가 탐색 바를 사용하지 않고 웹 페이지의 섹션을 탐색 할 수있는 곳을 찾고 있습니다. 페이지에는 4 개의 섹션이 있으며 각 섹션은 전체 화면 크기 (100vh)입니다. 사용자가 아래로 스크롤 할 때마다 다음 섹션으로 움직이는 자동 스크롤을 원합니다.jQuery : 스크롤을 트리거로 사용하여 섹션 간 자동 스크롤하는 방법
어떤 jQuery/javascript를 추가하면됩니다.
HTML :
<section></section>
<section></section>
<section></section>
<section></section>
CSS :
section {
background-color: #20c080;
height: 100vh;
width: 100vw;
}
UPDATE : jQuery를 :
$(window).scroll(function() {
var scroll = $(this).scrollTop();
console.log(scroll);
if (scroll > 100 && scroll < 200) {
$('html, body').animate({ scrollTop: $('#about').offset().top }, 'slow');
return false;
}
else if (scroll > 950 && scroll < 1050) {
$('html, body').animate({ scrollTop: $('#work').offset().top }, 'slow');
return false;
}
});
이 HTTPS를 도움이되기를 바랍니다 iscroll
는, JQuery와 아래처럼 스크롤 .com/cubiq/iscroll –