Answer the question
In order to leave comments, you need to log in
How to make dropdown menu of Woocommerce product categories in sidebar widget on click?
I wanted to implement a vertical menu of the product categories widget as an accordion, which, when you click on a specific category, opens subcategories. Tried plugins, but did not find a sensible solution. I came across one article , but I can not implement it. The menu structure and classes are identical.
<ul class="product-categories">
<li><a>Для малышей</a></li>
<li><a>Для мальчиков</a></li>
<li><a>Для девочек</a></li>
<li class="cat-parent"><a>Прочие игрушки</a>
<ul class='children'>
<li><a>Фигурки и персонажи</a></li>
<li><a>Игры</a></li>
<li><a>Конструкторы и головоломки</a></li>
<li><a>Другие игрушки</a></li>
</ul>
</li>
<li class="cat-parent"><a>Прочие товары</a>
<ul class='children'>
<li class="cat-item cat-item-19"><a>Мобили</a></li>
</ul>
</li>
</ul>
$(function() {
$('.product-categories .cat-parent').children('a').click(function() {
$(this).siblings('.children').slideToggle();
return false;
});
});
ul.children{
display: none;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question