Answer the question
In order to leave comments, you need to log in
How to make a two-element carousel bootstrap on handlebars with dynamic data?
Good afternoon.
There is an array with event data (data) that is loaded into the handlebar. Let's say 9 events in an array.
res.render(path.join(getSolutionViewFolder(), 'startPage.hbs'), {
layout: path.join(getSolutionViewFolder(), 'mainLayout.hbs'),
data: data
});
<div>
<h6 class=" font-weight-bold bg-dark" id="idsevents" >
<strong>Мероприятия</strong>
</h6>
<br>
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="text-white text-left d-flex">
{{#each data.events}}
{{#if @first}}
<div class="carousel-item active">
{{else}}
<div class="carousel-item">
{{/if}}
<div>
<a class="text-white" href="/site/idsnews?id={{{id}}}">{{{Date}}}</a>
<br>
<br>
<h6 class="text-white" href="/site/idsnews?id={{{id}}}"><strong>{{{Subject}}}</strong></h6>
<a class="text-white" href="/site/idsnews?id={{{id}}}">{{{Text}}}</a>
</div>
</div>
{{/each}}
</div>
</div>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question