scroll to the top automatically

1
Hi, When i am clicking on a button the position stay the same when i am opening a new page from a microflow. I cannot succeed to scroll automatically to the top in mendix, I tried a lot of things in js but nothing is working (i also try the scrollToAnchor module but it this not working either...) Someone have a practical solution please?    Thanks
asked
3 answers
2

Thanks for your time,

I did manage to do what I want with these lines of code in a js snippet: 

$( ".ButtonNextPage" ).click(function() {
document.getElementsByClassName("mx-name-container1")[0].scrollIntoView();
});

that scroll to the top just before the page is changing, that the only solution that worked properly for me.

answered
1

Add a html/javascript widget to the page with a small piece of javascript:

<script>
 $(document).ready(function(){
    $(window).scrollTop(0);
});
</script>

 

answered
1

Think Erwin's solution will work. But do you mean that you are on a page which is scrolled to the bottom, then click a button which opens a new page and the new page is also scrolled to the bottom? If so, this is not normal behavior. The new page should be automatically scrolled to the top. 

answered