元素的#2
id 仅在向下滚动后加载,因为我无法使用getElementById("#2")
.
//JS代码
$(document).ready(function() {
$('html, body').animate({
scrollTop: $("#2").offset().top
}, 'slow');
});
// waypoint code:
var infinite = new Waypoint.Infinite({
element: $('.infinite-container')[0],
context: document.getElementById('#16'),
onBeforePageLoad: function() {
$('.loading').show();
},
onAfterPageLoad: function($items) {
$('.loading').hide();
}
});
示例:在页面加载时仅显示 1,6,3,4,5
1
6
3
4
5
向下滚动后,我只得到 2,
2
我想在第一次加载年龄时直接滚动到“2”元素。