Trigger $(window).scroll();
Just use:
// Trigger the scroll event$(window).scroll();
Source:
Apply it to both body
and html
as it is not consistent.. (for example, FF uses the html
for scrolling while chrome uses the body
)
$("html, body").animate({scrollTop: someValue});
demo at http://jsfiddle.net/vzyVh/
You can try below code - here i am scrolling to top of my div tag which has id "one".
$('html,body').animate({ scrollTop: $('#one').offset().top }, 'slow');