Skip to content

How to preserve scroll position on swap #945

Answered by m4wh6k
m4wh6k asked this question in Q&A
Discussion options

You must be logged in to vote

Looking into this a little more, I think the answer is probably to use a different swap method than I'm using, such as afterend. This way, only elements inside the div are added rather than updating the whole parent div. I'm still interested to hear if htmx has some different magical way of doing this, but I won't hold out for that since the basic capabilities are already there.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by m4wh6k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant