Y
Y
yaroslav_void2019-07-18 18:34:09
Pug
yaroslav_void, 2019-07-18 18:34:09

How to give a class to a specific element from a loop?

5d309105d25a5212825194.png
How to make the first li (or any other that may be needed) have a class added after compilation, for example active.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-07-18
@yaroslav_void

each val, index in [ ... ]
  li
    a(class=index == 0 ? 'active' : '')

UPD. https://codepen.io/anon/pen/PrMmBx?editors=1100

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question