I want the scrollbar to be positioned on top by default as soon as I launch the page.But the below code works fine in chrome but not in IE11.
If I try to debug the script, the scrollbar is positioned on top.
$(document).ready(function () {
window.scrollTo(0,0);
}
I tried different solution online such as
$(window).scroll().scrollTop(0);
document.body.scrollTop(0);
But nothing worked in IE.Kindly help me
Definition and Usage The scrollTo() method scrolls the document to specified coordinates.
1)update mouse driver. 2) Installed windows updates. 3) cleared browser history and cleared browser cached files. 4) removed IE from windows and added again.
Though this is a very old question, but updating here for someone looking for a solution.
Try using:
element.scrollTop = 0;
This should work on all browsers.
Try using
$('body,html').scroll().scrollTop(0);
or
$('body,html').animate({scrollTop:0});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With