Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using default wp menu and I added some jquery for drop down slide effect. My problem comes when I hover <li> item because it displays all sub-menus in the same time.

Here is my Jquery which I added:

    $("#mine_menu ul.menu ul").css({ display: 'none' });
$("#mine_menu ul.menu li").hover(function() {
    $(this).find('ul.sub-menu')
        .stop(true, true).delay(200).animate({ "height": "show", "opacity": "show" }, 200 );
}, function(){
    $(this).find('ul.sub-menu')
        .stop(true, true).delay(50).animate({ "height": "hide", "opacity": "hide" }, 200 );
});

and here is my HTML output of my wp menu https://gist.github.com/2384269

share|improve this question
Not really a WPSE question, should be asked over at stack overflow, but try $('ul.sub-menu', this).stop(.. instead of $(this).find('ul.sub-menu').find.. – userabuser Apr 14 '12 at 13:32
Ok I will put this question on stack overflow. unfortunately your code didn't help. – Itachi Apr 14 '12 at 14:04

closed as off topic by Wyck, toscho Apr 14 '12 at 22:42

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. 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 closed questions here.

1 Answer

Instead of using the .find() method, go with .children():

$(this).children('ul.sub-menu')

I agree with userabuser, though - This question is not exactly in the scope of WPSE.

Also, since jQuery in wordpress is in no-conflict mode by default, you should make it

 jQuery(this).children('ul.sub-menu') 
share|improve this answer
Thx this works perfectly :) And I'm sorry that I added this question here. – Itachi Apr 14 '12 at 14:52

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