1

그래서 계산 버튼을 클릭하면 자동으로 차트 영역으로 스크롤하고 싶습니다. 이 코드를 가지고 :스크롤 부트 스트랩 3 모달

$('#budgetCalModal').animate({ 
    scrollTop: $("#result").offset().top 
    }, 1000); 

하지만 작동하지 않습니다. 부트 스트랩을 사용하고 있습니다. 3. 단서가 있습니까?

추신 : 모달이 창 높이보다 분명하게 커지면 스크롤해야합니다.

감사

enter image description here

+3

문제의 HTML 및 js 코드를 표시하십시오. 그리고 가장 좋은 방법은 문제가있는 bootply를 만드는 것입니다. – Sebsemillia

답변

0

내가 여기에이 문제를 해결할 수 있는지 모르겠지만는 바이올린입니다 - http://jsfiddle.net/qe1w87ba/ 당신이 모달 창에서 앵커 태그를 기준으로 원하는 않습니다.

<script> 
$(function() { 
    $('a[href*=#]:not([href=#])').click(function() { 
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 

     var target = $(this.hash); 
     target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 
     if (target.length) { 
     $('.modal').animate({ 
      scrollTop: target.offset().top 
     }, 1000); 
     return false; 
     } 
    } 
    }); 
}); 
</script>