jquery-a navigation bar effect for flash simulation

Source: Internet
Author: User

Demo Address: http://itxiaoming.sinaapp.com/demo05/demo.html

HTML code
  1. <html>
  2. <head>
  3. <meta http-equiv= "content-type" content="Text/html;charset=utf-8">
  4. <title>demo01</title>
  5. <link rel="stylesheet" type="text/css" href= "demo.css">
  6. <script type="Text/javascript" src="Jquery.js"></script>
  7. <script type="Text/javascript" src="Demo.js"></script >
  8. </head>
  9. <body>
  10. <div id="main">
  11. <div class="menu">
  12. <div class="Menu_b back1"></div>
  13. <span> Test </span>
  14. </div>
  15. <div class="menu">
  16. <div class="Menu_b back2"></div>
  17. <span> Test </span>
  18. </div>
  19. <div class="menu">
  20. <div class="Menu_b back3"></div>
  21. <span> Test </span>
  22. </div>
  23. <div class="menu">
  24. <div class="Menu_b back4"></div>
  25. <span> Test </span>
  26. </div>
  27. <div class="menu">
  28. <div class="Menu_b back5"></div>
  29. <span> Test </span>
  30. </div>
  31. <div class="menu">
  32. <div class="Menu_b back6"></div>
  33. <span> Test </span>
  34. </div>
  35. </div>
  36. </body>
  37. </html>

JS Code
  1. $ (document). Ready (function () {
  2. $ (". Menu"). MouseOver (function () {
  3. var div = $ (this). Children (". Menu_b");
  4. var span = $ (this). Children ("span");
  5. //Hide fonts, move to right 20px
  6. Span.stop (True,false). Animate ({opacity:' 0 ', left:' 20px '},200);
  7. //Show background animation
  8. Div.stop (True,false). Animate ({width:' 100px ', marginleft: '-50px ', Height:' 1px ', opacity:'  1 '},300);
  9. Div.animate ({height: '40px ', margintop:' -20px ', opacity:' 1 '},300);
  10. //Display font, move left 20px
  11. Span.animate ({opacity:' 1 ', left:' 0px '},300);
  12. Span.css ({color:' #FFF '});
  13. });
  14. $ (". Menu"). Mouseout (function () {
  15. var div = $ (this). Children (". Menu_b");
  16. var span = $ (this). Children ("span");
  17. //Hide font, move left 20px
  18. Span.stop (True,false). Animate ({opacity:' 0 ', left:' 20px '},200);
  19. //Show background animation
  20. Div.stop (True,false). Animate ({height:' 1px ', margintop: '0px ', opacity:' 1 '},300);
  21. Div.animate ({width: '0px ', marginleft:' 0px ', opacity:' 1 '},300);
  22. //Display font, move to right 20px
  23. Span.animate ({opacity:' 1 ', left:' 0px '},300);
  24. Span.css ({color:' #777 '});
  25. });
  26. });

The animation effect is I according to own liking to write, likes can change the special effect by oneself.

CSS Code
  1. /* demo01 CSS */
  2. #main {
  3. Background: #EEE;
  4. Display:inline-block;
  5. padding:10px;
  6. }
  7. . menu{position:relative;
  8. width:100px;
  9. height:40px;
  10. margin:10px Auto;
  11. }
  12. . menu_b{
  13. Position:absolute;
  14. width:0px;
  15. height:0px;
  16. background:red;
  17. z-index:1px;
  18. Top: 50%;
  19. Left: 50%;
  20. }
  21. . Menu span{
  22. Position:inherit;
  23. Display:block;
  24. Text-align:center;
  25. line-height:40px;
  26. z-index:3px;
  27. font-size:14px;
  28. Font-family: "Microsoft Yahei";
  29. Color: #777;
  30. Cursor:pointer;
  31. }
  32. . back1{
  33. Background: #FF0000;
  34. }
  35. . back2{
  36. Background: #921AFF;
  37. }
  38. . back3{
  39. Background: #00CACA;
  40. }
  41. . back4{
  42. Background: #00DB00;
  43. }
  44. . back5{
  45. Background: #FF5809;
  46. }
  47. . back6{
  48. Background: #E1E100;
  49. }

    • Demo05.zip (33.2 KB)

jquery-a navigation bar effect for flash simulation

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.