Hello. I have a list:
$('.top').click(function() { if ($(this).hasClass('open-menu')) { $(this).removeClass('open-menu'); $(this).parent().children('.pod-menu').slideUp('slow'); } else { $(this).addClass('open-menu'); $(this).parent().children('.pod-menu').slideDown('slow'); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul> <li> <span class='top'>ΠΠ΄Π΅ΠΆΠ΄Π° Π΄Π»Ρ ΠΌΠ°Π»ΡΡΠ΅ΠΉ</span> <div class='pod-menu'> <a>Π¨Π°ΠΏΠΊΠΈ</a> <a>ΠΠ±ΡΠ²Ρ</a> </div> </li> <li> <span class='top'>ΠΠ΄Π΅ΠΆΠ΄Π° Π΄Π»Ρ ΠΆΠ΅Π½ΡΠΈΠ½</span> <div class='pod-menu'> <a>Π¨Π°ΠΏΠΊΠΈ</a> <a>ΠΠ±ΡΠ²Ρ</a> </div> </li> <li> <span class='top'>ΠΠ΄Π΅ΠΆΠ΄Π° Π΄Π»Ρ ΠΌΡΠΆΡΠΈΠ½</span> <div class='pod-menu'> <a>Π¨Π°ΠΏΠΊΠΈ</a> <a>ΠΠ±ΡΠ²Ρ</a> </div> </li> <ul> By clicking on the top , I have dislpay: block added to the pod-menu , but if I click on another category, the previous category does not hide the submenu. Tell me how you can make it so that by clicking on one category of a submenu only hers would open, and the others would hide?