[Feature Request] "rootMargin" for revealed/intersect hx-trigger
Currently, HTMX's `revealed` and `intersect` triggers require an element to enter the viewport **precisely**, which is inefficient for infinite scrolling, because you want things to load _before_ user scrolled to the end of the list.
However, the built-in [`IntersectionObserver: rootMargin`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin) property works like a CSS margin. Setting it to `100px` expands the trigger area, so the request is sent 100px *before* the element actually enters the viewport.
So instead of just `root:<selector>` and `threshold:<float>` for `intersect` hx-trigger, I hope a `rootMargin` can also be added.
关闭于 2026-05-24 3 条评论