I am using the accordion to display the subcategories of each category.
My Problem is that I can't go to the subcategory of a category because it closes after the mouse out.
I want to keep the same architecture of the html:
Currently I have
jQuery(function($) {
$('ul.r-list h1').hover(function() {
$(this).next().stop(true, true).slideDown()
}, function() {
$(this).next().stop(true, true).slideUp()
}).find($(this).next()).hide()
});
ul.r-list li ul {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="r-list">
<li>
<h1>
<span class="collapse resp-toggle"><i class="fa fa-caret-right fa-lg"></i></span>
<a class="category Parent" href="">Parent Category</a>
<span>(8)</span>
</h1>
<ul>
<li>
<a class="category sub-category children1" href="">sub Category1</a>
<span>(5)</span>
</li>
<li>
<a class="category sub-category children2" href="">sub Category2</a>
<span>(1)</span>
</li>
<li>
<a class="category sub-category children3" href="">sub Category3</a>
<span>(2)</span>
</li>
</ul>
</li>
</ul>
Expected result:
when I go to child category the animation stop and when I mouse out it automatically closes.
Current result:
when i go to child category the animation didn't stop
Thanks in advance