ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

amp-carousel (type slides) actions speed up option #28618

Closed ka2jun8 closed 2 years ago

ka2jun8 commented 4 years ago

When the web site uses amp-carousel's 'on' action event 'slideChange', this event is called after finish completely moving the slide, because debouncedResetScrollReferencePoint_ uses debounce method.

https://github.com/ampproject/amphtml/blob/master/extensions/amp-base-carousel/0.1/carousel.js#L186

If another view changed by 'slideChange' action, users sometimes feel time lag.

So I'd be happy to configure debounce to throttle method. I rewrote it on hand and it looks like it worked as I thought it would.

Or, the inside component of amp-carousel (type slides) already has smoothScroll option. This option (smoothScroll: false) might be useful for this problem. It might be solved by allowing 'smoothScroll' option to propagate to 'goToSlide'.

references: https://github.com/ampproject/amphtml/blob/master/extensions/amp-base-carousel/0.1/carousel.js#L427 https://github.com/ampproject/amphtml/blob/master/extensions/amp-carousel/0.2/amp-carousel.js#L46-L62 https://github.com/ampproject/amphtml/blob/master/extensions/amp-carousel/0.2/amp-carousel.js#L240

maybe related: #23494

nainar commented 4 years ago

@alanorozco to take a look

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.