From f1b2ed93dfb5346e32c8b2b58c6f444d6ad24c50 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Tue, 5 Jan 2021 23:42:55 +0000 Subject: [PATCH] v4: Add an actual `data-touch="false"` example in the carousel docs (#32639) * v4: Add an actual `data-touch="false"` example in the carousel docs Backport of https://github.com/twbs/bootstrap/pull/32638 * Remove data-ride from example carousel * Correct attribute table explanation and remove slide class from example i believe the correct option is `slide` here, not `ride`. the `if "carousel"` bit was rather unclear/confusing * Edits... sorry, trying to make sense of our quirky carousel stuff, it seems some illogical things have been there ever since * Add data-interval to suppress autoplay * Tweak carousel options formatting * Update site/content/docs/4.5/components/carousel.md Co-authored-by: Mark Otto * Tweak language mostly based on @mdo's suggestion, but also adds the word "attribute" after `data-ride` for better flow/legibility Co-authored-by: Mark Otto --- site/content/docs/4.5/components/carousel.md | 38 +++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/site/content/docs/4.5/components/carousel.md b/site/content/docs/4.5/components/carousel.md index c0675050c1e4..b8fac60d38b4 100644 --- a/site/content/docs/4.5/components/carousel.md +++ b/site/content/docs/4.5/components/carousel.md @@ -208,6 +208,34 @@ Add `data-interval=""` to a `.carousel-item` to change the amount of time to del {{< /example >}} +### Disable touch swiping + +Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled using the `data-touch` attribute. The example below also does not include the `data-ride` attribute and has `data-interval="false"` so it doesn't autoplay. + +{{< example >}} + +{{< /example >}} + ## Usage ### Via data attributes @@ -242,7 +270,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap interval number 5000 - The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. + The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. keyboard @@ -253,15 +281,15 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap pause string | boolean - "hover" -

If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. If set to false, hovering over the carousel won't pause it.

-

On touch-enabled devices, when set to "hover", cycling will pause on touchend (once the user finished interacting with the carousel) for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.

+ 'hover' +

If set to 'hover', pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. If set to false, hovering over the carousel won't pause it.

+

On touch-enabled devices, when set to 'hover', cycling will pause on touchend (once the user finished interacting with the carousel) for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.

ride string false - Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load. + Autoplays the carousel after the user manually cycles the first item. If set to 'carousel', autoplays the carousel on load. wrap