所以当页面加载时,我希望它滑动到目标 div。
var todayStory = $('#day2main');
var initialOffset = 550;
$('.storyContainer').load('story.html', function() {
//story loads fine.
$('html,body').animate({scrollTop:$(todayStory).offset().top-initialOffset}, 1000);
//doesn't animate to div I indicate.
});
帮助!谢谢,麻烦您了!