CSS menus question

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
starstuff
Forum Newbie
Posts: 3
Joined: Sat Mar 08, 2008 6:54 am
Location: Third rock from the sun

CSS menus question

Post by starstuff »

Hi,

For days I haven't been able to find the answer to the following problem.

I have a testcase using css menu/AJAX with two levels similar to the one in this example http://www.alistapart.com/articles/horizdropdowns/

I have everything working except for an annoying behavior. When I open a submenu (2nd level) and click on it, by using AJAX the innerHTML field change to whatever text I want but the submenu remains open.

How can I close or refresh the menu/submenu when I click on it?
bertfour
Forum Commoner
Posts: 45
Joined: Fri Mar 07, 2008 7:33 am

Re: CSS menus question

Post by bertfour »

Better post your code, or put it online somewhere....
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: CSS menus question

Post by kaszu »

Probably to an element you have attached an event listener, so you can use 'this' in that function and

Code: Select all

this.style.display = 'none';
starstuff
Forum Newbie
Posts: 3
Joined: Sat Mar 08, 2008 6:54 am
Location: Third rock from the sun

Re: CSS menus question

Post by starstuff »

Here is quick example not using AJAX http://www.geocities.com/trifid_sagitarius/index.htm

Click on any 2nd level submenu, the text changes and the menu remains open.
bertfour
Forum Commoner
Posts: 45
Joined: Fri Mar 07, 2008 7:33 am

Re: CSS menus question

Post by bertfour »

Me thinks your <ul class="submenu"> needs an id as well, so you can close it....
starstuff
Forum Newbie
Posts: 3
Joined: Sat Mar 08, 2008 6:54 am
Location: Third rock from the sun

Re: CSS menus question

Post by starstuff »

kaszu wrote:Probably to an element you have attached an event listener, so you can use 'this' in that function and

Code: Select all

this.style.display = 'none';
Yep, that did it.

Thanks

[Edit] The only thing left is to reverse the procedure once the submenu disappears.
Post Reply