• Resolved Lolliedoll

    (@lolliedoll)


    Hi everyone!

    I’ve built a custom theme for my blog and I can’t get my dropdown menu working. I followed a tutorial using javascript, but I don’t know javascript very well. I think there is something wrong with this code, but I don’t know how to fix it:

    <script type="text/javascript">
    (function() {
        $("#navigation ul.menu ul").css({ display: 'none' });
        $("#navigation ul.menu li").hover(function() {
            $(this).find('ul.sub-menu')
                .stop(true, true).delay(10).animate({ "height": "show", "opacity": "show" }, 200 );
        }, function(){
            $(this).find('ul.sub-menu')
                .stop(true, true).delay(10).animate({ "height": "hide", "opacity": "hide" }, 200 );
        });
    });
    </script>

    Any help would be greatly appreciated! I want to be able to make my menus in the wordpress menus function and have the second level navigation actually work!

    xxMillie

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which tutorial are you following?
    Also see https://codex.www.ads-software.com/Using_Javascript

    Thread Starter Lolliedoll

    (@lolliedoll)

    I copied/pasted it all in ages ago and was a loser and didn’t bookmark where I got it from, so I don’t remember. The javascript I posted above is in the header.php file before </head> The script itself didn’t come in a file so linking it in isn’t possible and at this stage javascript is still completely over my head…

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    A reason why it’s not working is that it’s set to run ASAP, before any page elements are loaded.

    Other reasons could be that it’s not using noconflict wrappers or being enqueued.

    Thread Starter Lolliedoll

    (@lolliedoll)

    Thank you so much! It wasn’t using noconflict wrappers!! Now to code it to display better! I’ve been stuck on this for ages, thank you so much for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom theme dropdown menu not working’ is closed to new replies.