Layout images in Carousel bootstrap

Asked

Viewed 203 times

2

I have the following code snippet :

var images = [];

for (var i = 0; i < actions.length; i++) {
    for (var j = 0; j < actions[i].Images.length; j++) {

        var imagem = new Image();
        imagem.Description = actions[i].Images[j].Description;
        imagem.Url = actions[i].Images[j].Url;
        images.push(imagem);
    }
}

$('#carousel-imagens').append($("#imagesTemplate").tmpl(images));
$('#carousel-imagens').addClass("item");

The array var images stores the URL of various images I have. But as I pass this array pro carousel, he places the images one under the other. I would like them to be placed beside, which I must do ?

  • Hence who will be in charge of this is your CSS.

  • bootstrap mounts the layout

  • Are you using some Bootstrap plugin to build Carousel? Take a look at this tutorial, see if it helps you: W3schools

  • This same example I am following. but the images are not next to each other as in the example. are getting one under the other

1 answer

1

I decided as follows :

$('#carousel-imagens > div.item:eq(0)').addClass("active");

Only the first image should receive the class active, and the following ones didn’t. The way I was doing all the images received the active, so they were displayed one beneath the other.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.