Merge pull request #611 from jgirardet/patch-1

add missing intersect in reference + a tips when using overflow
This commit is contained in:
1cg 2021-11-12 15:23:42 -07:00 committed by GitHub
commit 0686aa5399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,10 @@ The response from the `/search` url will be appended to the `div` with the id `s
There are two special events that are non-standard that htmx supports: There are two special events that are non-standard that htmx supports:
* `load` - triggered on load (useful for lazy-loading something) * `load` - triggered on load (useful for lazy-loading something)
* `revealed` - triggered when an element is scrolled into the viewport (also useful for lazy-loading) * `revealed` - triggered when an element is scrolled into the viewport (also useful for lazy-loading). If you are using `overflow` in css like `overflow-y: scroll` you should use `intersect once` instead of `revealed`.
* `intersect` - fires once when an element first intersects the viewport. This supports two additional options:
* `root:<selector>` - a CSS selector of the root element for intersection
* `threshold:<float>` - a floating point number between 0.0 and 1.0, indicating what amount of intersection to fire the event on
### Triggering via the `HX-Trigger` header ### Triggering via the `HX-Trigger` header