When I initially load the page, It loads 10 items(1,2,3...10) and after scrolling down I am getting another 10 items(11,12,13,...20). But I need to directly scroll to the 12th element. I am using the Waypoint infinite scrolling(JQuery) and Django pagination.
Jquery :
$(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();
}
});
While scrolling down the data coming from the Django pagination by triggering the call :
http://localhost:8000/polls/?page=2&type=testpoll
I need to scroll to an element in the 'page=2' while loading the page initially. How can I do this?