aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick H. Lauke <[email protected]>2020-12-29 13:40:42 +0000
committerGitHub <[email protected]>2020-12-29 15:40:42 +0200
commitb05145c9510f210a408569a88239840c91814eff (patch)
tree1bdcb941fdc6223f94beeb357b1a61798c3372e8
parent122b2bdd485373c05eeab50c9f809db31117b898 (diff)
downloadbootstrap-b05145c9510f210a408569a88239840c91814eff.tar.xz
bootstrap-b05145c9510f210a408569a88239840c91814eff.zip
Add an actual `data-bs-touch="false"` example in the carousel docs (#32638)
* Add an actual `data-touch="false"` example in the carousel docs this can also make it easier to actually check/debug any issues we may have with this data attribute * Correct attribute table explanation and remove slide class from example
-rw-r--r--site/content/docs/5.0/components/carousel.md40
1 files changed, 34 insertions, 6 deletions
diff --git a/site/content/docs/5.0/components/carousel.md b/site/content/docs/5.0/components/carousel.md
index afa652945..6aa9f614f 100644
--- a/site/content/docs/5.0/components/carousel.md
+++ b/site/content/docs/5.0/components/carousel.md
@@ -206,6 +206,34 @@ Add `data-bs-interval=""` to a `.carousel-item` to change the amount of time to
</div>
{{< /example >}}
+### Suppressing touch swiping
+
+By default, carousels support swiping left/right on touchscreen devices to move between slides. This can be explicitly suppressed using the `data-bs-touch` attribute. The example below also does not include the `data-bs-ride` attribute, and has `data-bs-interval="false"`, meaning that it won't autoplay.
+
+{{< example >}}
+<div id="carouselExampleControlsNoTouching" class="carousel slide" data-bs-touch="false" data-bs-interval="false">
+ <div class="carousel-inner">
+ <div class="carousel-item active">
+ {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
+ </div>
+ <div class="carousel-item">
+ {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
+ </div>
+ <div class="carousel-item">
+ {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
+ </div>
+ </div>
+ <a class="carousel-control-prev" href="#carouselExampleControlsNoTouching" role="button" data-bs-slide="prev">
+ <span class="carousel-control-prev-icon" aria-hidden="true"></span>
+ <span class="visually-hidden">Previous</span>
+ </a>
+ <a class="carousel-control-next" href="#carouselExampleControlsNoTouching" role="button" data-bs-slide="next">
+ <span class="carousel-control-next-icon" aria-hidden="true"></span>
+ <span class="visually-hidden">Next</span>
+ </a>
+</div>
+{{< /example >}}
+
## Dark variant
Add `.carousel-dark` to the `.carousel` for darker controls, indicators, and captions. Controls have been inverted from their default white fill with the `filter` CSS property. Captions and controls have additional Sass variables that customize the `color` and `background-color`.
@@ -286,7 +314,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td><code>interval</code></td>
<td>number</td>
<td><code>5000</code></td>
- <td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td>
+ <td>The amount of time to delay between automatically cycling an item. If <code>false</code>, carousel will not automatically cycle.</td>
</tr>
<tr>
<td><code>keyboard</code></td>
@@ -297,15 +325,15 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<tr>
<td><code>pause</code></td>
<td>string | boolean</td>
- <td><code>"hover"</code></td>
- <td><p>If set to <code>"hover"</code>, pauses the cycling of the carousel on <code>mouseenter</code> and resumes the cycling of the carousel on <code>mouseleave</code>. If set to <code>false</code>, hovering over the carousel won't pause it.</p>
- <p>On touch-enabled devices, when set to <code>"hover"</code>, cycling will pause on <code>touchend</code> (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.</p></td>
+ <td><code>'hover'</code></td>
+ <td><p>If set to <code>'hover'</code>, pauses the cycling of the carousel on <code>mouseenter</code> and resumes the cycling of the carousel on <code>mouseleave</code>. If set to <code>false</code>, hovering over the carousel won't pause it.</p>
+ <p>On touch-enabled devices, when set to <code>'hover'</code>, cycling will pause on <code>touchend</code> (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.</p></td>
</tr>
<tr>
- <td><code>slide</code></td>
+ <td><code>ride</code></td>
<td>string | boolean</td>
<td><code>false</code></td>
- <td>Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load.</td>
+ <td>Autoplays the carousel after the user manually cycles the first item. If set to <code>'carousel'</code>, autoplays the carousel on load.</td>
</tr>
<tr>
<td><code>wrap</code></td>