<Columns>
<Column style="overflow: hidden">
<Carousel style="overflow: hidden">
@foreach (var bgclass in itemBgs)
{
<div class="@bgclass @B.Flex @B.JustifyContentCenter @B.AlignItemsCenter" style="height:340px;">
<Title>@bgclass</Title>
</div>
}
</Carousel>
</Column>
<Column style="overflow: hidden">
<Carousel style="overflow: hidden" Options="options">
@foreach (var bgclass in itemBgs)
{
<div class="@bgclass @B.Flex @B.JustifyContentCenter @B.AlignItemsCenter" style="height:340px;">
<Title>@bgclass</Title>
</div>
}
</Carousel>
</Column>
</Columns>
@code{
string[] itemBgs = {
B.BackgroundWarning,B.BackgroundBlack, B.BackgroundDanger,
B.BackgroundGrey, B.BackgroundInfo, B.BackgroundLink,
B.BackgroundSuccess,B.BackgroundGreyLighter
};
CarouselOptions options = new()
{
Autoplay = true,
Loop = true,
Infinite = true
};
}
<Carousel style="overflow: hidden" Options="options">
@foreach (var bgclass in itemBgs)
{
<div class="@bgclass @B.Flex @B.JustifyContentCenter @B.AlignItemsCenter" style="height:340px;">
<Title>@bgclass</Title>
</div>
}
</Carousel>
@code{
string[] itemBgs =
{
B.BackgroundWarning, B.BackgroundBlack, B.BackgroundDanger,
B.BackgroundGrey, B.BackgroundInfo, B.BackgroundLink,
B.BackgroundSuccess, B.BackgroundGreyLighter
};
CarouselOptions options = new()
{
SlidesToShow = 3,
Autoplay = true,
Loop = true,
Infinite = true
};
}
Name | Description | Default value |
---|---|---|
Name | Description | Default value |
InitialSlide |
Initial item index | 0 |
SlidesToScroll |
Slide to scroll on each step | 1 |
SlidesToShow |
Slides to show at a time | 1 |
Navigation |
Display navigation buttons | true |
NavigationKeys |
Enable navigation with arrow keys | true |
NavigationSwipe |
Enable swipe navigation | true |
Pagination |
Display pagination bullets | true |
Loop |
Activate loop display mode | false |
Infinite |
Activate infinite display mode | false |
Effect |
Animation effect for item transition (translate|fade) | translate |
Duration |
Transition animation duration (in ms) | 300 |
Timing |
Transiation animation type | ease |
Autoplay |
Autoplay carousel | false |
AutoplaySpeed |
Time between each transition when autoplay is active (ms) | 3000 |
PauseOnHover |
Stop autoplay when cursor hover carousel | true |
Carousel component provides some public methods to manually work with it.
next() | ||
---|---|---|
Slide to next item | ||
Parameters | ||
none |
||
Return values | ||
none |
previous() | ||
---|---|---|
Slide to previous item | ||
Parameters | ||
none |
||
Return values | ||
none |
start() | ||
---|---|---|
Start autoplay | ||
Parameters | ||
none |
||
Return values | ||
none |
stop() | ||
---|---|---|
Stop autoplay | ||
Parameters | ||
none |
||
Return values | ||
none |
show(index, force) | ||
---|---|---|
Show item at "index" a | ||
Parameters | ||
index |
Integer|null | Index of item to show |
force |
Boolean | Animate transition if true (default) or not if false |
Return values | ||
none |
reset() | ||
---|---|---|
Reset Carousel to initial values | ||
Parameters | ||
none |
||
Return values | ||
none |
文档