How can I detect when the last row of a repeating group is visible?
I’m not looking to scroll to the bottom, but rather to detect when the user has scrolled to the bottom. I’d like to change some visual styling when the end has been reached, but I can’t find any condition relating to the last row being visible.
Thanks for the reply. Those work, of course, and I have many conditions like those already.
Please let me explain more thoroughly:
How can I detect from outside of the repeating group that the last row is visible, so that I can style other elements on the page or show/hide a popup, etc. that are not part of the repeating group?
There’s no vanilla Bubble functionality for this, but one way you can do it is by using the Intersection Observer API to detect when a given element comes into view (i.e. when the target element intersects with the parent element, some other element, or the viewport).
Unfortunately, it hits on one of my pet peeves about Bubble. It runs from a workflow and I can’t set element properties (such as color) from a workflow.
I suppose I can use it to set a state and then use that state to trigger the style changes. I’ll work on it.
Yeah, you can set a custom state and use that as the basis for your conditions…
But, actually, you don’t even need to to do that… you can just give the JavaScript to Bubble element a value, and use that as the basis for your conditions.
I’ve updated the example, so it no longer uses a workflow… it just uses a condition based on the JavaScript To Bubble element’s value.