It is common in account management and other locations after logon. It is hidden by default. The drop-down details are displayed after you click it.
Demo
XML/HTML Code
- <Div style = 'margin: 50px '>
- <Div class = "dropdown">
- <A class = "account">
- <Span> My Account </span>
- </A>
- <Div class = "submenu" style = "display: none;">
- <Ul class = "root">
- Li>
- <A href = "# Dashboard"> Dashboard </a>
- </Li>
- <Li>
- <A href = "# Profile"> Profile </a>
- </Li>
- <Li>
- <A href = "# settings"> Settings </a>
- </Li>
- <Li>
- <A href = "# feedback"> Send Feedback </a>
- </Li>
- <Li>
- <A href = "# signout"> Sign Out </a>
- </Li>
- </Ul>
- </Div>
- </Div>
- </Div>
JavaScript Code
- <Script type = "text/javascript">
- $ (Document). ready (function ()
- {
- $ (". Account"). click (function ()
- {
- Var X = $ (this). attr ('id ');
- If (X = 1)
- {
- $ (". Submenu"). hide ();
- $ (This). attr ('id', '0 ');
- }
- Else
- {
- $ (". Submenu"). show ();
- $ (This). attr ('id', '1 ');
- }
- });
- // Mouseup textarea false
- $ (". Submenu"). mouseup (function ()
- {
- Return false
- });
- $ (". Account"). mouseup (function ()
- {
- Return false
- });
- // Textarea without editing.
- $ (Document). mouseup (function ()
- {
- $ (". Submenu"). hide ();
- $ (". Account"). attr ('id ','');
- });
- });
- </Script>
Address: http://www.freejs.net/article_daohangcaidan_134.html