Skip to content
Advertisement

carousel is not working when using with loop

I am using a carousel to slide an image. When I was using with a static image it was working fine, but when I used it with the data from database it is only showing the first element and not sliding. When I am click on the arrow then it’s also neither moving left nor right.

My view code is:

JavaScript

Advertisement

Answer

The div <div class="carousel-inner" role="listbox"> should be outside the foreach, as it’s a wrapper for the slide items and should not be used for each slide.

JavaScript

So:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement