The #2
id of an element only loads after scrolling down because I can't get it using getElementById("#2")
.
//JS code
$(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();
}
});
Example: On page loading only showing 1,6,3,4,5
1
6
3
4
5
after scrolling down i only getting 2,
2
I want to directly scroll to the '2' element in the first time age load.