2014-10-04 2 views
1

잘 모르겠습니다. 잘 설명해 드리겠습니다. HTML 컨텐트에 요소를 추가하여로드 할 때 브라우저가 자동으로 스크롤하도록 요청합니다. 닻처럼. 그래서 :자동으로 HTML로 라인을 수직으로 스크롤하는 방법은 무엇입니까?

| visible area | 
| content html | 
| content html |  our monitor 
| content html | 
| content html | 
---------------- 
| 
| 
| * here comes the HTML element which will ask the browser to scroll here 
| 
| 

답변

0
$(document).ready(function() 
{ 
    $("html,body").animate({scrollTop: 200}, 1000); 
} 

되지는 않을 컨텐츠 HTML을 감싸는 당신의 요소가됩니다

0
$(document).ready(function(){ 
    var scrolldiv = $('#content'); 

    $('html, body').animate({ 
     scrollTop: $(scrolldiv).offset().top 
    }, 1000); 
}); 

scrolldiv 일을 알려 주시기 때문에 테스트;

관련 문제