Layout images in carousel bootstrap

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");

array var images stores the URL of several images I have. But by passing this array pro carousel , it places the images one underneath the other. I would like them to be placed next, what should I do?

    
asked by anonymous 04.01.2017 / 19:33

1 answer

1

I solved it as follows:

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

Only the first image should receive the active class, and the following not. The way I was doing all the images they received active , so they were displayed one underneath the other.

    
05.01.2017 / 12:38