Simple drop-down menu

Source: Internet
Author: User

<!DOCTYPE HTML><HTML><Head><Scripttype= "Text/javascript"src= "Jquery-1.11.1.js"></Script><style>nav a{text-decoration:None;    }NAV > ul > Li{float: Left;text-align:Center;padding:0 0.5em;    }nav Li Ul.sub-menu{Display:None;Padding-left:0!important;    }. sub-menu Li{Color: White;    }. sub-menu li:hover{Background-color:Black;    }. sub-menu li:hover a{Color: White;    }ul{List-style:None;    }</style></Head><Body>    <nav>    <ul>        <Li><ahref="#">Home<ulclass= "Sub-menu">            <Li><ahref="#">Sub1</a></Li>            <Li><ahref="#">Sub2</a></Li>            <Li><ahref="#">Sub3</a></Li>        </ul>        </Li>        <Li><ahref="#">Programming<ulclass= "Sub-menu">        <Li><ahref="#">Sub1</a></Li>            <Li><ahref="#">Sub2</a></Li>            <Li><ahref="#">Sub3</a></Li>        </ul>        </Li>        <Li><ahref="#">Japanese<ulclass= "Sub-menu">            <Li><ahref="#">Sub1</a></Li>            <Li><ahref="#">Sub2</a></Li>            <Li><ahref="#">Sub3</a></Li>        </ul>        </Li>            </ul>    </nav></Body><Scripttype= "Text/javascript">$ (document). Ready (function() {        $('nav Li'). Hover (function() {            $( This). Find ('. sub-menu'). CSS ('Display', 'Block'); }, function() {            $( This). Find ('. sub-menu'). CSS ('Display', 'None');    }); });</Script></HTML>

The following can also be

$ (document). Ready (function () {        //NAV    $ ("#nav ul li"). Hover (function () {        $ (this). addclass (' hover ');        $ (this). FIND ("UL"). Show ();//mouse over find the first UL under Li and then display;    },function () {        $ (this). Removeclass (' hover ');        $ (this). FIND ("ul"). Hide ();//mouse away from hidden Li under the UL;    })        Showtime ();});

Simple drop-down menu

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.