Click the show menu drop-down menu

Source: Internet
Author: User

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
  1. <Div style = 'margin: 50px '>
  2. <Div class = "dropdown">
  3. <A class = "account">
  4. <Span> My Account </span>
  5. </A>
  6. <Div class = "submenu" style = "display: none;">
  7. <Ul class = "root">
  8. Li>
  9. <A href = "# Dashboard"> Dashboard </a>
  10. </Li>
  11. <Li>
  12. <A href = "# Profile"> Profile </a>
  13. </Li>
  14. <Li>
  15. <A href = "# settings"> Settings </a>
  16. </Li>
  17. <Li>
  18. <A href = "# feedback"> Send Feedback </a>
  19. </Li>
  20. <Li>
  21. <A href = "# signout"> Sign Out </a>
  22. </Li>
  23. </Ul>
  24. </Div>
  25. </Div>
  26. </Div>

 

JavaScript Code
  1. <Script type = "text/javascript">
  2. $ (Document). ready (function ()
  3. {
  4. $ (". Account"). click (function ()
  5. {
  6. Var X = $ (this). attr ('id ');
  7. If (X = 1)
  8. {
  9. $ (". Submenu"). hide ();
  10. $ (This). attr ('id', '0 ');
  11. }
  12. Else
  13. {
  14. $ (". Submenu"). show ();
  15. $ (This). attr ('id', '1 ');
  16. }
  17. });
  18. // Mouseup textarea false
  19. $ (". Submenu"). mouseup (function ()
  20. {
  21. Return false
  22. });
  23. $ (". Account"). mouseup (function ()
  24. {
  25. Return false
  26. });
  27. // Textarea without editing.
  28. $ (Document). mouseup (function ()
  29. {
  30. $ (". Submenu"). hide ();
  31. $ (". Account"). attr ('id ','');
  32. });
  33. });
  34. </Script>

 


Address: http://www.freejs.net/article_daohangcaidan_134.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.