C
C
cybersunt2018-03-04 13:13:04
Slider
cybersunt, 2018-03-04 13:13:04

How to write a cycle for slider layout?

You want pug to compile the following output

<div class="slideshow">
  <ul class="slideshow__list">
    <li class="slideshow__item slideshow__item--active">1 слайд</li>
    <li class="slideshow__item">2 слайд</li>
    <li class="slideshow__item">3 слайд</li>
  </ul>
</div>

Tell me how to write a cycle in a paga. which would add an additional class to the first element of the list?
All data for filling slideshow_item is taken from json file
I had the following construction which didn't work
.slideshow
  ul.slideshow__list
    each slide, value, index in slides
      if index === 0 
         li.slideshow__item.slideshow__item--active= slide.text
      else li.slideshow__item= slide.text

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question