Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm currently using this little jQuery toggle snippet to show/hide child categories using the wp_list_categories function;

$('.sidebar ul.children').hide(); // Start by hiding child categories

$(".sidebar li.parent-item").hover(function () {
$(".sidebar ul.children").slideToggle("slow");

But currently hovering over any list item with the class parent-item makes every child menu toggle.

Is there a way to make it work only on the list item that is hovered over?

share|improve this question
add comment

closed as off topic by s_ha_dum, Johannes Pille, toscho Apr 24 '13 at 15:16

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 0 down vote accepted

Use

$(".sidebar li.parent-item").hover(function () {
   $(this).find("ul.children").slideToggle("slow");
});
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.