JQuery implements simple level-2 drop-down menu and jquery drop-down menu

Source: Internet
Author: User

JQuery implements simple level-2 drop-down menu and jquery drop-down menu

Html code

<Div class = "UpLayer"> <dl> <dt> <a href = "javascript: void (0) "> helper house </a> </dt> <dd> <a href =" http://www.demo.com/js/ "> special effects </a> <a href =" http://www.demo.com/Tutorials/ "> tutorial </> <a href = "http://www.demo.com/zy/"> resources </a> <a href = "http://www.demo.com/mb/"> templates </a> <a href = "http://www.demo.com/news/"> Information </a> </dd> </dl> </div>

Js Code

<Script type = "text/javascript"> // [classic] pop-up menu $ (document ). ready (function () {var objStr = ". upLayer "; $ (objStr ). each (function (I) {$ (this ). click (function () {$ (objStr + "dd") [I]). show (); $ (objStr + "dt") [I]). addClass ("UpLayer02") ;}; $ (this ). hover (function () {}, function () {$ ($ (objStr + "dd") [I]). hide (); $ (objStr + "dt") [I]). removeClass ("UpLayer02") ;}) ;}}); </script>

Css code

Body, h1, h2, h3, h4, h5, h6, p, ol, ul, li, dl, dt, dd {padding: 0; margin: 0 ;} li {list-style: none;} img {border: none;} u {text-decoration: none;} em {font-style: normal;} a {color: #424242; text-decoration: none; outline: none; blr: expression (this. onFocus = this. blur ();} body {font-size: 12px; font-family: Arial, Verdana, Helvetica, sans-serif; word-break: break-all ;}. box {margin: 0 auto; text-align: left; width: 920px ;}. clear {clear: both;}/* [classic] pop-up menu */. upLayer {margin: 100px ;}. upLayer dl dt {width: 50px; position: absolute; z-index: 3; padding: 0 5px; line-height: 20px ;}. upLayer02 {border: # ccc 1px solid; border-bottom: none; background: # f1f1f1; margin:-1px 0 0-1px ;}. upLayer dl dd {width: 80px; position: absolute; z-index: 2; border: # ccc 1px solid; padding: 5px; line-height: 20px; background: # f1f1f1; display: none; margin: 19px 0 0-1px ;}. upLayer dl dd a {display: block; border-bottom: # ccc 1px dashed ;}

It is best not to forget to insert the jQuery js file, but to download the latest one.

The above is all the content of this article. I hope you will like it.

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.