0

I suddenly had the following stop working:

Html

<a id="scrollTop" href="#">Scroll</a>

jquery

 $("#scrollTop").on("click", function(e){
   e.preventDefault();
   $('html, body').animate({scrollTop: 0}, 'slow');
 });

If I check in console I get this message

body.scrollTop is deprecated in strict mode. Please use 'documentElement.scrollTop' if in strict mode and 'body.scrollTop' only if in quirks mode.

But I haven't changed anything so I don't get it. I did check on other SO questions but it still doesn't work and more importantly I don't understand why it sudden started doing this

Community
  • 1
  • 1
rob.m
  • 9,843
  • 19
  • 73
  • 162

1 Answers1

1

I had overflow-x on body in css. Shouldn't be using overflow on body when doing that (scrollTop). Removed it and page is working

rob.m
  • 9,843
  • 19
  • 73
  • 162