waypoints 플러그인을 확인합니다.
현재 섹션이 맨 아래에 도달하면 내 데모가 스냅되도록 변경했습니다.
섹션 높이가 커서 사용자가 충분히 스크롤하지 않아도 해당 섹션의 내용을 볼 수 없으면 현재 섹션의 맨 위로 스냅하지 않아야합니다.
바쳐 대한
http://jsfiddle.net/T89LF/4/show
http://jsfiddle.net/T89LF/4/
HTML
<section></section>
<section></section>
<section></section>
<section></section>
<section></section>
jQuery를
$('section').waypoint(function(direction) {
if(direction == 'down'){
disable_scroll();
//Animate to top of the section
$('html, body').stop().animate({
scrollTop: $(this).offset().top
},300,"easeInOutQuart", function() {
enable_scroll();
});
}
}, { offset: '100%' });
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
}
function wheel(e) {
preventDefault(e);
}
function disable_scroll() {
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = wheel;
}
function enable_scroll() {
if (window.removeEventListener) {
window.removeEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = null;
}
안녕, 정말 고마워요 데모 대답 할 시간. 이 솔루션의 문제점은 백업 화면을 스크롤 할 때 스냅해야하며이 화면과 같이 가장 가까운 부분과 가장 가까운 부분에 따라 상단 또는 하단의 두 섹션 사이에있을 때 스냅됩니다 (http : // d). .pr/i/uA3F - 스냅하는 부분까지 아래로 스크롤 한 다음 다시 스크롤하십시오. 다시 튀어 나와야합니다. 감사! – user3067058
나는 먼저 그런 것을했는데, http://jsfiddle.net/T89LF/1/show/ 그러나 이것은 당신이 내용을 읽었을 때 짜증나게 할 부분의 어느 지점에서나 짤 것이다. 그래서 나는 이것을 다시 볼 필요가있다. – hyperdrive
안녕하세요. 정말 고맙습니다! 그게 바로 제가 찾고 있던 것입니다! :) 감사!! – user3067058