Z
Z
zuraavl2015-10-15 01:36:26
JavaScript
zuraavl, 2015-10-15 01:36:26

How to make click work correctly?

Hello.
I have many .rout-item elements and on click on each one, certain events should occur with it.
But these events happen to absolutely all .rout-item

Here is what I tried to do, nothing comes out. What to do?
codepen.io/Zuraavl/pen/QjqMVa

$('.rout-item').click(function (e) {
    $('.rout-item').removeClass("active");
    $(this).addClass("active");
    $('.rout-details').slideDown();
    $('.rout-controls').slideDown();
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Volintsev, 2015-10-15
@copist

Presumably ALL $('.rout-details') and ALL $('.rout-controls') are shown.
You need to find one that should be shown, and the rest should be collapsed.
But without an HTML example, it's impossible to answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question