$(window).scroll event does not fire


Harald Schneider

I tried to implement some kind of elevator button, which allows the user to scroll back to top at the end of long lists or texts. The button should appear automatically after the user scrolled e.g. 100px downwards and disappear, if the list has reached its top again.

Example here: https://codepen.io/rdallaire/pen/apoyx

However, it looks like Angular supresses the scroll event: https://stackoverflow.com/questions/33600605/window-scroll-not-working-in-augular-controller

Do you see any chance to get this working? Or maybe add a custom control for this functionality?


DecSoft

Hello Harald,

Probably what happen is that we must adapt the code to our app. For example, copy the below text and save it as a file named "TopLink.ab". Open that file with App Builder and run the app. As you can see, there is no problem to use the code that you wanted (or better said, to get the results that you wanted) using an HTML control, for example. I am not sure, however, if you wanted something like this or other thing.

The CSS code has been placed in the app's Inline CSS option. The Javascript (adapted) has been placed in the app's view Show event. Below is what you must see when run the app:



DecSoft

Hello Harald,

Here is another sample, this time scrolling the app's view itself, not an specific HTML Content control. Instead of refer to "window", we refer to ".appView", which is a class that all the views have. Take a look at the same parts than in the above sample.

Here is how this sample look:



Harald Schneider
Perfect! You saved my day :-) Thank you!

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.