Forums

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

Home Forums JavaScript Fixing simple drop-down menu

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #44402
    Kuzyo
    Participant

    Hi everyone.
    I want to implement really simple drop-down menu and here what I did http://jsfiddle.net/BWVyH/. I’m complete beginner in JS and I know that my code is awful.
    I wasn’t able to do – when you put a mouse on a Submenu it didn’t hide, I tried by canceling hiding, but it didn’t work for me and as a result I set Timeout = 3000; :(

    Please, help me to fix this problem and optimize my code. I will be very greatful. Thanks.

    #133373
    rodolpheb
    Participant

    Hi, here are two tutorials with and without Jquery. hope it might help.

    http://cssmenumaker.com/blog/flat-dropdown-menu-tutorial

    http://codepen.io/Alhadis/pen/FsEjz

    #133394
    Kuzyo
    Participant

    Thanks for the help, I will try to find solution, but want to make it without jQuery

    #133396
    rodolpheb
    Participant

    So you can try the first link….

    #133403
    Kuzyo
    Participant

    Sorry for confusing you, want to make without JQuery but with pure JS :(

    #133408
    Kuzyo
    Participant

    It seems I fixed it. Now I can move on submenu and it doesn’t disappear but I have to move my mouse very gently if I want menu work properly …why it so?http://codepen.io/anon/pen/HoJfI

    #133409
    CrocoDillon
    Participant

    You need to find a way to make it possible to move the mouse pointer from the menu item to the submenu without triggering mouseout on the menu item. I’ve done this for the first level by adding a padding to `.menu > li`, quick and dirty because I wanted to focus on the JS. Here is the result:

    http://jsfiddle.net/BWVyH/1/

    #133412
    Kuzyo
    Participant

    Hi CrocoDilian, nice to see you again :) Your code is very difficult for me (, but I understand what do you mean

    #133414
    CrocoDillon
    Participant

    Hey :) Added some comments: http://jsfiddle.net/BWVyH/2/

    If you have any specific questions let me know.

    #133424
    Kuzyo
    Participant

    Cool. Now I saw on practise how works NodeList. If I right understand querySelectorAll it the same like getElementByTagName Can I write something like this

    var submenu = el.getElementByTagName(‘ul’)[0];

    #133435
    CrocoDillon
    Participant

    Yeah that would work as well :) `getElementsByTagName`*

    #133448
    Kuzyo
    Participant

    CrocoDillion, can you give me some excersice for practice JS (I think you can imagine what level of knowledge I have) because almost everithing what I found in Internt is difficult. I very appreciate your help

    #133450
    CrocoDillon
    Participant

    https://developer.mozilla.org/en-US/docs/JavaScript under “TOOLS & ADVANCED RESOURCES” you’ll find what you’re looking for. Their own guide and reference can be a help as well, I find their reference a bit hard to navigate and usually use Google to find something on that website.

    By the way, you sure are creative about misspelling my name :P

    #133454
    CrocoDillon
    Participant

    Found this in my bookmarks as well: http://eloquentjavascript.net/

    #133464
    Kuzyo
    Participant

    CrocoDillon, sorry for the name ( Thanks for your help and time

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