나는 폭이 변하는 2 개의 컨테이너가 있습니다. 그 안에는 클릭 가능한 요소가 있습니다. 컨테이너를 클릭하면 애니메이션에서 크기가 조절됩니다. 클릭 가능한 요소를 클릭하면 해당 컨테이너의 크기가 조정되고 클릭 된 요소로 스크롤되도록 구성하려고합니다. 여기에 이것을 보여주는 바이올린이 있습니다 : http://jsfiddle.net/w7H3M/1/애니메이션 중간에 JQuery ScrollTop?
그러나 크기 조정 때문에 잘못된 위치로 스크롤됩니다. 클릭 이벤트 처리기는 다음과 같습니다.
<div id=left>...</div>
<div id=right>...</div>
$('#left').on('click', 'a', function() {
var node = $(this);
$('#left').animate({
width: 0.75 * $(document).width()
}, 800);
$('#right').animate({
width: 0.25 * $(document).width()
}, 800);
$('body').animate({
scrollTop: node.offset().top
}, 800);
});
$('#right').on('click', 'a', function() {
var node = $(this);
$('#left').animate({
width: 0.25 * $(document).width()
}, 800);
$('#right').animate({
width: 0.75 * $(document).width()
}, 800);
$('body').animate({
scrollTop: node.offset().top
}, 800);
});