-1

I am very close. How can I have MENU 1 on my .fiddle display as the default menu option then change when MENU 2 on hover?

Thank you in advance. Keep coding! :)

Elvis
  • 243
  • 1
  • 2
  • 8
  • 1
    Your fiddle already works right? – Praveen Kumar Purushothaman Jun 12 '15 at 13:45
  • 3
    Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. – Paulie_D Jun 12 '15 at 13:45
  • Praveen Kumar, the fiddle works however I am having trouble on having MENU 1 display on default. On hover on MENU 2, hide MENU 1. – Elvis Jun 12 '15 at 14:18

1 Answers1

2

To edit this entirely away from jquery based on your response do the following:

  1. Change #submenu1 from display:none; to display: block;
    This will Show your first menu by default.

  2. Add the following css section

    #a2:hover ~ #submenu1 { display: none; }

The ~ character selects #submenu1 when you hover over a2 element. Then it changes it to display:none;. Since you have code already to set submenu2 to display when you hover over a2, all this does is hide the submenu1 element.

Todd J.
  • 267
  • 2
  • 11
  • Thank you Todd. I would like to have it powered by CSS only. – Elvis Jun 12 '15 at 15:49
  • @Elvis I have updated my response based on this. Much simpler and I learned something too! – Todd J. Jun 12 '15 at 15:58
  • Just a quick note: if this worked for you, can you mark it as the accepted answer? :) Thanks @Elvis ! – Todd J. Jun 12 '15 at 16:11
  • [fiddle](http://fiddle.jshell.net/king2525/64nmpjyh/3/) When I hover over MENU 2 then hover over to ITEM2, ITEM2 changes to ITEM 1. Thank you. – Elvis Jun 16 '15 at 13:24
  • can you help with the request above? – Elvis Jun 17 '15 at 20:34
  • Hey @Elvis, I will look at the issue and try and write something up tomorrow. I see what you mean though. Perhaps some sort of delay can fix it. http://stackoverflow.com/questions/17100235/make-css-hover-state-remain-after-unhovering may be relevant – Todd J. Jun 18 '15 at 00:51
  • Hi @Todd, can you please help this morning? Thank you – Elvis Jun 22 '15 at 13:37