Skip to content

Commit 5bfe12e

Browse files
Merge branch 'main' into patrickhlauke-navs-tabs
2 parents b3993db + b05145c commit 5bfe12e

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

site/content/docs/5.0/components/carousel.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,34 @@ Add `data-bs-interval=""` to a `.carousel-item` to change the amount of time to
206206
</div>
207207
{{< /example >}}
208208

209+
### Suppressing touch swiping
210+
211+
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.
212+
213+
{{< example >}}
214+
<div id="carouselExampleControlsNoTouching" class="carousel slide" data-bs-touch="false" data-bs-interval="false">
215+
<div class="carousel-inner">
216+
<div class="carousel-item active">
217+
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}}
218+
</div>
219+
<div class="carousel-item">
220+
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}}
221+
</div>
222+
<div class="carousel-item">
223+
{{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}}
224+
</div>
225+
</div>
226+
<a class="carousel-control-prev" href="#carouselExampleControlsNoTouching" role="button" data-bs-slide="prev">
227+
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
228+
<span class="visually-hidden">Previous</span>
229+
</a>
230+
<a class="carousel-control-next" href="#carouselExampleControlsNoTouching" role="button" data-bs-slide="next">
231+
<span class="carousel-control-next-icon" aria-hidden="true"></span>
232+
<span class="visually-hidden">Next</span>
233+
</a>
234+
</div>
235+
{{< /example >}}
236+
209237
## Dark variant
210238

211239
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
286314
<td><code>interval</code></td>
287315
<td>number</td>
288316
<td><code>5000</code></td>
289-
<td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td>
317+
<td>The amount of time to delay between automatically cycling an item. If <code>false</code>, carousel will not automatically cycle.</td>
290318
</tr>
291319
<tr>
292320
<td><code>keyboard</code></td>
@@ -297,15 +325,15 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
297325
<tr>
298326
<td><code>pause</code></td>
299327
<td>string | boolean</td>
300-
<td><code>"hover"</code></td>
301-
<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>
302-
<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>
328+
<td><code>'hover'</code></td>
329+
<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>
330+
<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>
303331
</tr>
304332
<tr>
305-
<td><code>slide</code></td>
333+
<td><code>ride</code></td>
306334
<td>string | boolean</td>
307335
<td><code>false</code></td>
308-
<td>Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load.</td>
336+
<td>Autoplays the carousel after the user manually cycles the first item. If set to <code>'carousel'</code>, autoplays the carousel on load.</td>
309337
</tr>
310338
<tr>
311339
<td><code>wrap</code></td>

0 commit comments

Comments
 (0)