Show Scroll up button when user scrolls down from top of the page

1
Hi!  I have added "Scroll up" buttons within my app and they are working fine, but at the moment they are always visible at the bottom right corner, even if the user already is at the top of the page.   How can I display the button only when the user scrolls downs, say, at least 20px?   Elina
asked
1 answers
1

Hi Elina,

 

I beleive this article might prove helpful, not sure if it's achievable with pure CSS (https://isotropic.co/how-to-show-an-element-after-scrolling-halfway-down-the-page-js/). Here you could set the scrollY check to be 20px. Just make sure to refer to the correct DOM element, as with most Mendix apps the window object is likely going to be fixed, and you need the layout element with vertical scroll. Here's a Stackoverflow solution with the same idea behind: https://stackoverflow.com/questions/72500421/css-how-to-hide-an-element-based-on-position-within-page

 

Hope this helps!

Best regards,

András

answered