Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jsFiddle – Help with jQuery simple drop down.

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #35096
    theplastickid
    Participant

    Can someone please take a look at this and help me where I am going wrong I am so rubbish with jQuery!

    http://jsfiddle.net/9XMS9/

    Many Thanks.

    #90352
    Mottie
    Member

    Try this

    Basically, I hide the sub_menu, then added a hover event on the dropdown which fades in the sub_menu on mouseover and fades the sub_menu out when the mouse leaves. If you need more of an explanation, just ask :)

    $("ul.sub_menu").fadeOut();
    $('ul.dropdown').hover(function(){
    $("ul.sub_menu").stop().fadeIn();
    },function(){
    $("ul.sub_menu").stop().fadeOut();
    });
    #90481
    theplastickid
    Participant

    I have tried your code but can’t see it working.

    Immediately on page load the menu appears then fades away but when I hover it doesn’t reappear.

    #90483
    jamygolden
    Member

    I just pasted in @Mottie’s script, it seems to be working.

    remember that javascript area on JSFiddle only accepts javascript, not the HTML script tags.

    #90494
    theplastickid
    Participant

    This is crazy works perfectly in the jsFiddle but not on my local server. Must be something conflicting.

    #90504
    jamygolden
    Member

    You should add this to your page:

    (remember jsfiddle does the script tag and the on dom load for you)

    #90548
    theplastickid
    Participant

    Excellent works a treat mate.

    Is there a better way to write this so when the page loads I don’t see the menu fade out?

    #90593
    jamygolden
    Member

    Yeah there is:

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.