admin管理员组

文章数量:1296907

I have a snap-y snap-mandatory overflow-y-scroll container with several items inside. The snap is working, but I don't like how the snap is animated.

Is there any way to control the animation of the snap?

I had hoped that transitions might offer some control over this, but (unless I'm misunderstanding something) it seems that transitions are really meant for items entering or leaving the DOM.

I'm using Svelte and TailwindCSS; so, if either of these libraries provide an easy way of doing this, please let me know. If it's only possible to achieve this by writing something from scratch, I'll probably just leave it be.

I have a snap-y snap-mandatory overflow-y-scroll container with several items inside. The snap is working, but I don't like how the snap is animated.

Is there any way to control the animation of the snap?

I had hoped that transitions might offer some control over this, but (unless I'm misunderstanding something) it seems that transitions are really meant for items entering or leaving the DOM.

I'm using Svelte and TailwindCSS; so, if either of these libraries provide an easy way of doing this, please let me know. If it's only possible to achieve this by writing something from scratch, I'll probably just leave it be.

Share asked Feb 11 at 16:56 Mackie MesserMackie Messer 1,3282 gold badges11 silver badges24 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 1

As you noted, Svelte's transitions deal with elements being added/removed.

The scroll snap animations are controlled by the browser and there does not seem to be a way to affect the animation itself. There is the scroll-behavior property but that does not have many options and none that would affect scroll snapping.

本文标签: javascriptIs there anyway to control the snap animation using Svelte or TailwindCSSStack Overflow