Grow your CSS skills. Land your dream job.

jQuery DropDown Sidebar Navigation Help

  • # August 13, 2008 at 8:01 am

    Hello everyone

    This is my first post, so far I’ve manage to get by through just reading what everyone else has to say but I’m afraid I need some specific help and hopefully I’ll understand a little bit better.

    I am creating a sidebar jQuery drop down navigation for a site. It’s a simple drop down I’m after that when the user mouses over they will see more sub-links should there be any. Here’s the XHTML I’ve written for it.

    I need the list items underneath "Our Projects" to drop down when hovered over and disappear when the mouse moves away. The jQuery code I’ve come up with either hides everything or hides nothing when I mouse over.

    All help will be gratefully received.

    Regards

    Adam

    # August 13, 2008 at 6:48 pm

    you need to post your jquery code also.

    # August 14, 2008 at 5:34 am

    I was hoping I wouldn’t have to embarrass myself by doing that. I was hoping someone would just be able to look at the XHTML and give me the jQuery code. Better yet would be someone who could talk me through what each bit of the code was doing.

    # August 14, 2008 at 7:53 am

    a quick google brings up http://ayozone.org/2008/02/06/drop-down-menu-with-jquery/.

    Have a look what the code is doing and go from there -

    Code:


    Roll over this text to show the menu

    # August 14, 2008 at 9:38 am

    Thanks for your reply, I have Googled it already and looked at a similar effect to the one Jeffrey @ detatcheddesigns.com demonstrated in a jQuery tutorial on there but I couldn’t get it to work.
    I suppose I’ll keep trying.

    # August 15, 2008 at 9:28 am

    Alright, I’ve got it doing what I want it to do and it’s okay for now.

    XHTML

    jQuery

    Code:
    $(document).ready(function()

    {
    $(“li.subnav”).hide();
    $(“li.topnav”).hover(
    function()
    {
    $(“li.subnav”).slideDown();
    },
    function()
    {
    $(“li.subnav”).slideUp();
    });
    });

    But I’ve tested this with more than one subnav and of course, when you mouse over one topnav list item it slides down all subnav list items, not just set you want when you hover over the topnav one that you want.

    Any help will be gratefully received.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".