Can hx-trigger="load" only execute if the element is visible? #1142
deanebarker
started this conversation in
General
Replies: 3 comments 1 reply
-
Same issue here, did you find a solution? |
Beta Was this translation helpful? Give feedback.
0 replies
-
No, sorry. But I did figure out how to tie stuff to document events, which is probably how I would approach it now. (I answered my own question there...) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Yes, in that example, I was listening for an event on the body (so, the entire document). I believe you can listen for events on specific elements too. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some elements that are hidden on mobile. They have
hx-trigger="load"
on them, and theGET
request is executing even when they're not shown.I tried changing it to
hx-trigger="revealed"
, but they still executed, because they are technically in the viewport, they're just not visible.I'd like this to not execute if they're hidden.
Beta Was this translation helpful? Give feedback.
All reactions