Class not updating
#4290
-
I want a header class ("hidden") to be set depending on wether the user a scrolled up or down.
|
Beta Was this translation helpful? Give feedback.
Answered by
ekwoka
Jul 9, 2024
Replies: 1 comment 1 reply
-
Your scroll handlers You need to bind the handler, or ideally, just use alpine to register the handler. <header x-data="stickyHeader" :class="{ 'hidden': hidden }" @scroll.window="scroll"></header> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
OvalMedia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your scroll handlers
this
does not refer to the data context, it refers to thewindow
.You need to bind the handler, or ideally, just use alpine to register the handler.