You need to add smoothness to open the tab . There is a block, when you click on the li of the "classes advantages-col " class, the lower div block of the " panel " class appears. But it appears abruptly, I need to add smoothness. Through jQuery I tried using fadeIn and fadeToggle , unfortunately it does not work correctly, that is, the smoothness works but opens all or several tabs at the same time. I also tried to add transition to the active class and add styles to the block with javascript. Unfortunately, too, to no avail. Please help. Thanks in advance for your reply.
var tabPanels = document.querySelectorAll(".panel"); var tabButtons = document.querySelectorAll(".advantages-col"); function showPanel(panelIndex) { tabButtons.forEach(function(node) { node.classList.remove("active"); }); tabButtons[panelIndex].classList.add("active"); tabPanels.forEach(function(node) { node.style.display = "none"; }); tabPanels[panelIndex].style.display = "flex"; } <ul> <li data-target="#protect" onclick="showPanel(6)" class="advantages-col active"> <div class="flex part_one_adv"> <div data-target="#protect">ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</div> </div> </li> <div class="panel active" id="protect"> <div class="flex panel_col"> <div class="pl-16"> <h4>ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</h4> <p>ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</p> </div> </div> <div class="mob_menu_btn"><button type="button" class="btn btn-red-light call-modal-show">ΠΡΡΠ°Π²ΠΈΡΡ Π·Π°ΡΠ²ΠΊΡ</button></div> </div> <li data-target="#protect2" onclick="showPanel(7)" class="advantages-col"> <div class="flex part_one_adv"> <div data-target="#protect2">ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</div> </div> </li> <div class="panel" id="protect2"> <div class="flex panel_col"> <div class="pl-16"> <h4>ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</h4> <p>ΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡΠΠ°ΡΠΈΡΠ° ΠΎΡ ΠΏΡΠΎΠ½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΡ</p> </div> </div> <div class="mob_menu_btn"><button type="button" class="btn">ΠΡΡΠ°Π²ΠΈΡΡ Π·Π°ΡΠ²ΠΊΡ</button></div> </div> </ul>