I used the code provided here to scroll to the top of an html element after an onclick-event.
The code works correctly only the second time when the users clicks the same link. The first time the link is clicked, the page actually does scroll, but not far enough. Does anyone know how to solve this? Thanks!
The javascript code is provided as attachment. The function toggleGalleryBox() runs when the user clicks a ‘li’ element. The section-tag should appear on top of the viewport by using the function scrollTo(0, Yposition).
The code is used for my personal website (see my profile).