A
A
alexandr kirindyasov2019-04-30 09:00:31
css
alexandr kirindyasov, 2019-04-30 09:00:31

Appearance and disappearance of a certain block when clicking on a link. How to implement?

https://codepen.io/3avarka4/pen/jRRRoV

Help with the code, I'm not friends with scripts;)

3 blocks with a link and each has a hidden black class.
When you click on the link, you need this hidden class to appear, only for this block. Also, when you press it again, it disappears.
I would also like it to be smoother.
I could only implement , so that the hidden class appears for everyone at the same time, and this is not what you need ;(
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2019-04-30
@3avarka

In order not to suffer with parent(), put identifiers through data attributes
https://codepen.io/anon/pen/xeeNJN

D
Dmitry, 2019-04-30
@slo_nik

Good morning.

$(document).ready(function(){
  $('.trigger ').click(function(){
    //$('.black').toggle();
    $(this).parents('.block').find('div.black').fadeToggle()
  });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question