1. Create Helper EntityCreate a non-persistent entity called ScrollHelper with a boolean attribute:AtBottom (default = false)
2. Add Data ViewInside your page, add a Data View that creates this ScrollHelper using a nanoflow.Inside the data view, add both buttons.
3. Set Visibility on Buttons: Button 1: “Scroll to Bottom” → Visible when AtBottom = false Button 2: “Go to Next Page” → Visible when AtBottom = true
4. Give Scroll Container a Class Name:For example: class = "terms-scroll"
5. Add JavaScript Snippet:
Add an HTML/JavaScript widget (or JavaScript action in nanoflow) with this code:
setTimeout(() => {
const container = document.querySelector(".terms-scroll");
if (!container) return;
container.addEventListener("scroll", () => {
const isAtBottom = container.scrollTop + container.clientHeight >= container.scrollHeight - 20;
mx.data.get({
xpath: "//ScrollHelper",
callback: function(objs) {
if (objs.length > 0) {
objs[0].set("AtBottom", isAtBottom);
}
}
});
});
}, 1000);