A
A
Anastasia Dementieva2017-04-04 17:47:14
Layout
Anastasia Dementieva, 2017-04-04 17:47:14

How to make markup with pug?

each item, index in title
   li(class="mobile-categories__item" + ((item == "Контурная пластика (Инъекционная коррекция)") ? " mobile-categories-item_active" : ""))
      span.mobile-categories__icon
            img(src=icons[index] alt = alt[index])
      span(class='mobile-categories__text'+ ((item == "Контурная пластика (Инъекционная коррекция)") ? " mobile-categories-text_active" : ""))= item
      .mobile-close2.mobile-close2_position

How to make an element with classes .mobile-close2.mobile-close2_position only added if above element has active classes mobile-categories-item_active and mobile-categories-text_active

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-04-04
@sguschenka

each item, index in title

  - var isActive = ( item === "Контурная пластика (Инъекционная коррекция)" );

  li.mobile-categories__item(class=( isActive ? 'mobile-categories-item_active' : false ))
    span.mobile-categories__icon
      img(src=icons[index] alt=alt[index])
    span.mobile-categories__text(class=( isActive ? 'mobile-categories-text_active' : false ))= item
    if isActive
      .mobile-close2.mobile-close2_position

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question