I am not sure why this isn't working
html
<a href="#" id="scrollTop" class="margin-top-40 btn btn-danger btn-lg top btn-not-100">Back to top</a>
jQuery
$("#scrollTop").on("click",function(e){
e.preventDefault();
$(window).animate({scrollTop: 0}, 'slow');
});
Even tried the following with still negative results
$("#scrollTop").on("click",function(e){
e.preventDefault();
$("body, html").animate({scrollTop: 0}, 'slow');
});
Css
html, body {height:100%;}
Using jquery-1.10.2.js, consolle not giving any error
UPDATE Comments below lead me to understand the issue is with using jQuery scrollTop and html, body set to overflow... Because of that a new question has been created here on stack.
Got the issue, thanks to comments I noticed I had body: overflow-x:hidden
which means scrollTop isn't working when we are using overflow on body, html
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