The submenu is displayed and you don't want to hide it.

Source: Internet
Author: User

Today there is a small function, that is mouse after the main menu, the submenu will be permanently displayed, unless the page is refreshed.

First look at the effect of the year implementation:

HTML code:


Source Code:

<DivID= "Top">            <DivID= "Top_1">                <ul>                                       <Listyle= "position:relative;">                        <ahref="#"ID= "Menu1"style= "text-decoration:none; color:white;">Main Course Name</a>                        <ulID= "SubMenu1"style= "width:300px; position:absolute; display:block;">                            <Li><ahref="#">Sub-dish name one</a></Li>                            <Li><ahref="#">Sub-dish name two</a>|</Li>                            <Li><ahref="#">Sub-dish name three</a>|</Li>                            <Li><ahref="#">Sub-dish name four</a>|</Li>                        </ul>                    </Li>                </ul>            </Div>        </Div>
View Code


Using the jquery library:

<src= "~/scripts/jquery-2.2.1.js"></script> 


Write JS code:


Source Code:

$ (function  () {            $ ("#SubMenu1"). Hide ();                       $ ("#Menu1"). MouseOver (function  () {                                showpublish ();            });        });                function Showpublish () {            $ ("#SubMenu1"). Show ();        }
View Code


Next is the style:


Style Source code:

#top{Height:36px;width:100%;Margin-right:Auto;Margin-left:Auto;Background-color:#006428;Line-height:36px;text-align: Left;}#top #top_1{Height:36px;width:1110px;Line-height:36px;Margin-right:Auto;Margin-left:Auto;}#top #top_1 ul{margin:0px;padding:0px;List-style-type:None;}#top #top_1 Li{Display:Block;float: Right;width:Auto;Line-height:36px;Color:#FFFFFF;Height:36px;font-size:14px;}
View Code

The submenu is displayed and you don't want to hide 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.