Cannot scroll to top

rss

Posted by Dan_C - Jul 22 ’16 at 11:21

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/select2/select2_locale_en_us.js

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

 

Any ideas?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 10 months 25 days
    #1 by Dmitry Kozlov Jul 25 ’16 at 10:39

    Hi,

    Please, try the following code:

    $('#s4-workspace').scrollTop(0);
    
  • Dan_C
    Member
    Member for: 5 years 8 months 20 days
    #2 by Dan_C Jul 25 ’16 at 12:29

    [#1]: Works.  You're a great help.  Thanks.

Displaying 1 to 2 of 2 messages