Question

I'm using the impress.js framework (which apparently sets strict mode) and get the below message in Google Chrome when trying to scroll a nested DIV to its topmost location:

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

So, the below will not work for me when I click my "Scroll Up" button in the hopes of resetting a nested DIV to its top:

$('html,body').animate({ scrollTop: $('#panel-scroller').offset().top });

You can see it fail at my test site:

http://www.berklie.com/stack

Can anyone tell me an alternative piece of code which to use, so that I can scroll to the top of the DIV when I click my "Scroll Up" button?

Thank you in advance!

Was it helpful?

Solution

the deprecation warning does not break functionality for now.

at least not on the pages i am using it on.

the problem is that the $('html,body') elements you animate are at scrollTop 0 already.

try: $('#tile-row-edit').animate({'scrollTop': 0});

this even works from the javascript console on your demo.

have fun

jascha

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top