Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reset the scroll position in a scroll view

ANSWERED

Is it possible to reset the scroll position in a scroll view via JavaScript? I'd like to show and hide a scroll view and have it reset to the top every time it's shown.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

I figured this out:

 

Interface

<svg>
  <use id="sv" href="#scrollview">
    <use href="#scrollview-item">
      <image href="01.png" load="sync" />
    </use>
    <use href="#scrollview-item">
      <image href="02.png" load="sync" />
    </use>
    <use href="#scrollview-item">
      <image href="03.png" load="sync" />
    </use>
  </use>
</svg>

 

JavaScript

document.getElementById("sv").value = 0; 

View best answer in original post

Best Answer
2 REPLIES 2

I figured this out:

 

Interface

<svg>
  <use id="sv" href="#scrollview">
    <use href="#scrollview-item">
      <image href="01.png" load="sync" />
    </use>
    <use href="#scrollview-item">
      <image href="02.png" load="sync" />
    </use>
    <use href="#scrollview-item">
      <image href="03.png" load="sync" />
    </use>
  </use>
</svg>

 

JavaScript

document.getElementById("sv").value = 0; 
Best Answer

Thanks davey this was driving me mad.

Best Answer
0 Votes