How to make a smooth drop-down accordion. I imply that it is regulated by the installation of the height of the block and its own transcription. Do not give the fish, write the words that he did.
var btn_title = document.querySelectorAll('.test_title'); var disc = document.querySelectorAll('.test_disc'); for (var i = 0; i < btn_title.length; i++) { btn_title[i].addEventListener('click', fun_open); function fun_open(event) { for (var i = 0; i < btn_title.length; i++) { disc[i].classList.remove('test_disc_show'); if (btn_title[i] == event.currentTarget) { disc[i].classList.toggle('test_disc_show'); } } } } html .test { height: 1000px; } html .test_title { width: 180px; height: 30px; background: red; border: 1px solid black; } html .test_disc { width: 180px; height: 80px; background: blue; display: none; border: 1px solid black; } html .test_disc_show { display: block; transition: all 0.9s; } <div class="test"> <div class="test_title test_title_one">test_title test_title_one</div> <!-- /.test_title --> <div class="test_disc test_disc_one">test_disc test_disc_one</div> <!-- /.test_disc --> <div class="test_title test_title_two">test_title test_title_two</div> <!-- /.test_title --> <div class="test_disc test_disc_two">test_disc test_disc_two</div> <!-- /.test_disc --> <div class="test_title test_title_one">test_title test_title_one</div> <!-- /.test_title --> <div class="test_disc test_disc_one">test_disc test_disc_one</div> <!-- /.test_disc --> <div class="test_title test_title_two">test_title test_title_two</div> <!-- /.test_title --> <div class="test_disc test_disc_two">test_disc test_disc_two</div> <!-- /.test_disc --> </div> <!-- /.test -->
display: none;transition-нуcan not be - Air