Doing it with style
At last!
Now that the latest versions of Safari and Chrome support :active with the adjacent and general sibling selectors we are only left to find an answer to this problem in IE and the iPad, iPhone and iPod Touch.
In previous demos I have use a browser specific .htc file for Internet Explorer and a CPU hungry keyframe answer for the iPad, iPhone and iPod touch.
Well now I have found even simpler methods to trigger these browsers into supporting :active and the sibling selectors and this demo show it in action.
Click the top level items with down arrows to slide down the sub menus, then click the same tab (or another tab) to close the open sub menu. On PC browsers you can also click anywhere else on the page to close an open sub menu.
The slide animation is visible in Firefox 4+, Safari, Chrome, Opera, iPad, iPhone and iPod Touch.
The simple fix for IE is to add an 'onclick' to the body tag that does nothing more than force a refresh: <body onclick="this.className=this.className"> - simple.
For the iPad, iPhone and iPod Touch the CSS answer is to add a style for the top level ul that does nothing: .menu:active {} - even simpler.
Now to find a CSS only answer for IE.
Because of all the time and effort spent in producing this demonstration I would ask that you respect my copyright.
This demonstration can be used subject to the following terms and conditions.
Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.