2017-12-28 6 views
0

사실 내가 최고Jquery를 사용하여 아래쪽으로 스크롤하는 방법?

var container = $('#items_suggession_right'), scrollTo = $(".selected"); 
     container.animate({scrollTop: scrollTo.offset().top - container.offset().top + 
         container.scrollTop()}, 0); 

에 스크롤 다음 코드를 사용하고하지만 난 바닥에서 설정 스크롤 할 수 기운 다. 당신은

var time = 0; // in milliseconds 
$("html, body").animate({ scrollTop: $(document).height() }, time);. 

당신은 바닥에 부드럽고 애니메이션 스크롤을 제공하기 위해 시간 값을 증가시킬 수있다 사용할 수 있습니다 나를 JQuery와

+4

가능한 중복 https://stackoverflow.com/ 질문/1890995/jquery-scroll-to-bottom-of-page-iframe) – fen1x

답변

0

jsfiddle code updated for scroll to bottom

\t $(document).ready(function() { 
 
    $('html,body').animate({ 
 
      scrollTop: $('.testwrap').height() 
 
     }, 800); 
 
    });
.testwrap{ 
 
    width: 500px; 
 
    height: 1000px; 
 
    border: 2px dotted #c00; 
 

 
}
<!doctype html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="x-ua-compatible" content="ie=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">   </script> 
 

 

 
</head> 
 
<body> 
 
    <div class="testwrap"></div> 
 
</body> 
 
</html>

([페이지/iframe이 하단에 jQuery를 스크롤]의
1

를 사용하여 아래로 스크롤을 설정하는 제발 도와주세요.

0

페이지 하단으로 스크롤하려면 다음 코드를 입력하십시오.

container.animate({ scrollTop: $(document).height() }, 0); 
0
$(document).on("click","#bottom",function() { 
    var window_height = $(window).height(); 
    var document_height = $(document).height(); 
    $('html,body').animate({ scrollTop: window_height + document_height },1000); 
}); 

는 희망이 도움이!

0
$(document).ready(function() { 

    $('#buttonID').click(function(){ 
     $('html, body').animate({scrollTop:$(document).height()}, 'slow'); 
     return false; 
    }); 

}); 

이 코드 부분을 사용하십시오.

+0

Stack Overflow에 오신 것을 환영합니다! 이 코드는 문제를 해결하는 데 도움이 될 수 있지만 이유 및/또는 질문에 대한 대답을 설명하지는 않습니다. 이러한 추가적인 맥락을 제공하면 장기적인 교육적 가치가 크게 향상 될 것입니다. 어떤 제한 사항 및 가정이 적용되는지를 포함하여 설명을 추가하여 답을 편집하십시오. –

0

당신은 사용할 수 있습니다

$('html').animate({ scrollTop: $(document).height() }, 1000);