Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    my function only fires once, why?

    alright so im a noob to js (so if my jargon isn't quite right I apologize).

    I wrote this program:


    [CODE]
    function drown() {
    $('#nav li a').mouseover(
    function() {
    $('#nav li ul').show();
    });
    $('#nav li a').mouseout(
    function() {
    $('#nav li ul a').hide();
    });
    };
    [CODE]

    which is for a drop down navigation menu. Its real basic, but its my first program from scratch. the only problem is that it only fires once, meaning when i mouse over the parent li it only "drops down" the child ul and "brings it up" only one time. The subsequent times I mouse over nothing occurs.

    I have spent hours reading forums and books but I'm still lost. If you need the html or css documents let me know.

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    If you are using FireFox or Chrome, open an error console and see what the message is. If you are using IE, look for a yellow exclamation mark in the lower-left corner of the browser; if there is one, double click it to open an error console.

  • #3
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have opened up the error consoles for both chrome and firefox and there aren't any errors. So I believe I am missing a step in the program that allows me to continually fire the mouseover event, but I don't know where.

  • #4
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yay, i finally figured it out.

  • #5
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    What was the issue? If you don't mind my asking. Professional curiosity.

    ^_^

  • #6
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    in the mouseout function i wrote

    $('#nav li ul a').hide();

    it should have been

    $('#nav li ul').hide();


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •