Closed ka2jun8 closed 3 years ago
Hi @ka2jun8. Thank you for your bug report. amp-carousel
type=carousel
slides the carousel by 1 viewport when the prev/next button is clicked. This is the intended behavior. If you'd like there to always be one slide shown in the carousel, you can use type=slides
. Additionally, if you'd like to have multiple slides in view on a carousel, you can try <amp-base-carousel visible-count="2">
. See test/manual/amp-base-carousel/grouping-autoadvance.amp.html
as an example and https://amp.dev/documentation/components/amp-base-carousel/?format=websites#visible-count for documentation.
Closing this issue since this behaviour is as specified. Feel free to comment again with other thoughts and we can reopen if needed.
@micajuine-ho
Thank you for your advices :)
you can use type=slides
Sorry, I think our use case is not like that case. I want to display a next carousel image a little bit because it causes to be interested for users.
However this is a hint for me,
Because the option visible-count
can be set a decimal number like visible-count="1.5"
.
I had no idea to use amp-base-carousel, instead of amp-carousel. I think it is useful for me, thank you!
What's the issue?
We use amp-carousel (type carousel) for displaying multiple components horizontally. When
amp-carousel-button-next
is clicked, it is scrolled the same as width of carousel component (i-amphtml-carousel-scroll
) to right. On the other hand, if the carousel component width and carousel item width are different, carousel moving position seems weird.Before click next button
After click next button
The moveScrollOneViewport_ function is using
el./*OK*/ scrollLeft += el./*OK*/ offsetWidth * forwardsMultiplier * directionMulitplier;
.https://github.com/ampproject/amphtml/blob/master/extensions/amp-carousel/0.2/amp-carousel.js#L315-L316
I'd like to modify to use
this.currentIndex_
likethis.goToSlide(this.currentIndex_)
?How do we reproduce the issue?
What browsers are affected?
Which AMP version is affected?