I use this javascript to control a menu dropdown.
Is it possible to tell the script always to display sub-menus – but only if there are any?
Hope someone can help.
Ex code: http://jsfiddle.net/zQU7H/
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDITED TO MEET NEEDS EXPLAINED ON COMMENTS
After understanding what you need (please, next time try to explain your question a little better), here is a and updated Fiddle that mgiht help you. In this case I supossed (correct me if I’m wrong) that ou don’t use link with hashes in your site, and what it does is search for a hash at url, this hash, should be equal to the title of the a element (you can highlight it) you’ll like to show submenu of. Example:
<a title="Bestilling" href="http://www.example.com/mypage.html#Handelsbetingelser"></a>You can do this manually or with jquery:
This code will add a hashtag and the title menu parent.
ORIGINAL
I don’t know if I understood your question right, but in case it helps, I’ve updated khaled_webdevs Fiddle: http://jsfiddle.net/zQU7H/5/.
It just show one submenu at a time, and changes it if another one should be shown. On this example I made the first element with submenu to be shown, but you can remove that and make any submenu you wan’t to show at first by addign to it the class “current”.
Hope this helps.