Page 1 of 1

Cannot scroll to top

Posted: 22 Jul 2016
by Dan_C
I have my form inside a tab control and next buttons disabling tabs and switching to the next tab. I have one tab that's longer than the next so when I click next at the bottom the tab switchesfine, but I have to scroll up to see the new active tab. Trying to avoid this by scrolling to the top with the next button click as well.



Tried all of these and none seem to work:

window.scrollTo(0, 0);

window.scrollBy(0, -100);

$("html, body").animate({ scrollTop: 0 }, 600);

window.location.href = "#top"; //href at the top



No errors in console other than this:

https://services.spform.com/CSL/scripts ... e_en_us.js

But that is showing on all my forms and doesn't seem to cause any problems.

Re: Cannot scroll to top

Posted: 25 Jul 2016
by Dmitry Kozlov
Hi,

Please, try the following code:

Code: Select all

$('#s4-workspace').scrollTop(0);

Re: Cannot scroll to top

Posted: 25 Jul 2016
by Dan_C
Works. You're a great help. Thanks.