carousel() html()
An image carousel with captions, indicators and arrows.
html()->carousel($data = [], $extra = [])Опції
| Опція | Значення |
|---|---|
$data | Slides: an image URL, or ['img', 'desc' (HTML caption), 'alt']. |
id | Default carousel_<n>. |
fade, interval, pause, ride, touch, wrap, keyboard, theme | Bootstrap 5 options of the carousel. |
Приклад
Код
$slide = fn ($text, $color) => 'data:image/svg+xml,' . rawurlencode('<svg xmlns="http://www.w3.org/2000/svg" width="870" height="300"><rect width="870" height="300" fill="' . $color . '"/>'
. '<text x="435" y="150" fill="#fff" font-family="sans-serif" font-size="40" text-anchor="middle">' . $text . '</text></svg>');
css('.carousel { max-width: 870px; }');
return html()->carousel([
['img' => $slide('First slide', '#337ab7'), 'desc' => '<h4>First label</h4><p>Captions are HTML.</p>'],
['img' => $slide('Second slide', '#5cb85c'), 'desc' => '<h4>Second label</h4>'],
['img' => $slide('Third slide', '#f0ad4e'), 'alt' => 'Third slide'],
$slide('Fourth slide', '#5bc0de'),
$slide('Fifth slide', '#d9534f'),
$slide('Sixth slide', '#777777'),
]);Примітки
- The demo draws inline SVG slides, so the page needs no network.
Bootstrap 3 and 5
Bootstrap 3 carousel (.item); Bootstrap 5 carousel-item with data-bs-* options.
Див. також: html/thumbnails, demo:html/bs5_options