B
B
Boris2016-11-10 16:03:48
PHP
Boris, 2016-11-10 16:03:48

How to add the active class to the active record of the Bitrix infoblock?

It is necessary that records from the news infoblock be displayed as slides in a slider. The problem is that the active slide in the bootstrap carousel must have the active class. How can I add it using php. Without the active class, the slides are not displayed.
Standard carousel output:

<div id="myCarousel" class="carousel slide">
  <!-- Carousel items -->
  <div class="carousel-inner">
    <div class="active item">…</div>
    <div class="item">…</div>
    <div class="item">…</div>
  </div>
  <!-- Carousel nav -->
  <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
  <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Korolev, 2016-11-11
@STREEET

What exactly is the problem?
In the template of the component that displays the news, in the template.php file, add the condition that if this is the first element of the array, then add the active class to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question