1
안녕하세요. 두 개의 탐색 화살표가있는 탐색 메뉴가 있습니다. 이전 및 다음. 이 기능은 Chrome을 제외하고 모든 브라우저 (Firefox, IE, Opera, Safari)에서 정상적으로 작동합니다. 버튼을 누르면 오류 메시지도 표시되지 않습니다.Chrome에서 스크롤 문제가 발생했습니다.
누군가 코드 버튼을 살펴 보시기 바랍니다. 내가 놓친 게 있니?
감사합니다.
function scroll(direction) {
var scroll, i, positions = [], here = $(window).scrollTop(), collection = $('.box'), duration = 750, easing = "easeOutExpo";
collection.each(function() {
positions.push(parseInt($(this).offset()['top'], 10));
});
for(i = 0; i < positions.length; i++) {
if(direction == 'next' && positions[i] > here) {
scroll = collection.get(i);
break;
}
if(direction == 'prev' && i > 0 && positions[i] >= here) {
scroll = collection.get(i-1);
break;
}
}
if(scroll) {
$.scrollTo(scroll, { duration: duration, easing: easing });
}
return false;
}
$("a#prev, a#next").click(function() {
return scroll($(this).prop('id'));
});