摘要:動態移到某個捲軸的位置
很簡單,套用就好了,
<div id="scrollable" style="overflow: auto; height: 220px; width: 260px; border: 1px solid #000">
var targetOffset = $target.offset().top;
$('html,body').animate({scrollTop: targetOffset}, 1000);
$(document).ready(function() {
$('#scrollit').click(function() {
var divOffset = $('#scrollable').offset().top;
var pOffset = $('#scrollable p:eq(2)').offset().top;
var pScroll = pOffset - divOffset;
$('#scrollable').animate({scrollTop: '+=' + pScroll + 'px'}, 1000, 'easeOutBounce');
});
});