diff --git a/knowledge-base/carousel-thumbnail-scrollable-navigation.md b/knowledge-base/carousel-thumbnail-scrollable-navigation.md new file mode 100644 index 0000000000..f4b4266e9d --- /dev/null +++ b/knowledge-base/carousel-thumbnail-scrollable-navigation.md @@ -0,0 +1,150 @@ +--- +title: Carousel Thumbnail Scrollable Navigation +description: How to use thumbnails in scrollable navigation for the Carousel? +type: how-to +page_title: Carousel Thumbnail Scrollable Navigation +slug: carousel-kb-thumbnail-scrollable-navigation +position: +tags: telerik,blazor,carousel,thumbnail,navigation,images +ticketid: 1550292 +res_type: kb +--- + +## Environment + + + + + + + +
ProductCarousel for Blazor
+ + +## Description +How to add a thumbnail scrollable navigation below the page/image in Carousel? This would be a nice addition, which would allow independent scrolling from that of the current page. It will also be clickable in the same way that the dots are to jump to the selected page. + +## Solution +To add a thumbnail scrollable navigation: + +1. Add HTML `
` container under the `Carousel` markup. +2. Apply custom CSS with the needed styles to the container. +3. Inside the `
`, loop through all the images in `Carousel` and define them in a smaller size. +4. Optionally, use a javascript function that keeps the synchronization of the `AutomaticPageChange` and the thumbnail. + +![](images/carousel-thumbnail-navigation.png) + +>caption Component + +````CSHTML +@inject IJSRuntime JSRuntime; + + + + + +
+
+ @foreach (var img in CarouselData) + { + Photograph + } +
+
+ + + + +@code { + public List CarouselData { get; set; } + public int PageIndex = 1; + + public async Task PageChangedHandler(int newPage) + { + PageIndex = newPage; + await JSRuntime.InvokeVoidAsync("ScrollToCurrentPage", newPage); + } + + protected override Task OnInitializedAsync() + { + CarouselData = Enumerable.Range(0, 13).Select(x => new CarouselModel + { + ImageID = x + 1, + ImageUrl = $"https://demos.telerik.com/blazor-ui/images/photos/{x % 7 + 1}.jpg" + }).ToList(); + + return base.OnInitializedAsync(); + } + + public class CarouselModel + { + public int ImageID { get; set; } + public string ImageUrl { get; set; } + } +} + + +```` diff --git a/knowledge-base/images/carousel-thumbnail-navigation.png b/knowledge-base/images/carousel-thumbnail-navigation.png new file mode 100644 index 0000000000..1b261d2fda Binary files /dev/null and b/knowledge-base/images/carousel-thumbnail-navigation.png differ