이 스크립트는 맨 위로 스크롤합니다. 아래로 스크롤하려면 어떻게 변경할 수 있습니까?
이것은 내 스크립트입니다.
$(document).ready(function(){
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
});
당신은 이것을 시도 할 수 있습니다
$("#DIV1").animate({
scrollTop: $('#DIV2').offset().top - $("#DIV1").offset().top + $("#DIV1").scrollTop()-80
},800);
여기서 DIV2는 스크롤하려는 DIV이고 DIV1은 스크롤하려는 위치입니다.
값 80을 다른 값으로 변경하면 어떤 위치에서든 스크롤 할 수 있습니다.
위 또는 아래로 스크롤하려면 값을 늘리거나 줄입니다.
희망은 당신을 위해 일합니다
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다