This is displayed after hovering
This figure is displayed after the mouse clicks
If you move the mouse over the mouse, if you do not click it, the system will show restoration. If you click it, the system will show restoration. However, after you click it, the drop-down menu will still be displayed, the drop-down menu is only taken back after you click the other place, and clicking the other place becomes the core issue to be solved.
Copy to ClipboardReference: [www.bkjia.com] document. onclick = function (event)
{
Var e = event | window. event;
Var elem = e. srcElement | e.tar get;
While (elem)
{
If (elem. id = "subMenu ")
{
Return;
}
Elem = elem. parentNode;
}
// Hide the subMenu Method
HideDiv ();
}
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <meta http-equiv =" Content-Type "content =" text/html; charset = gbk "/> <style type =" text/css "> body {margin: 0; padding: 0;/* for ie * // * font: 12px/1 Tahoma, Helvetica, Arial, "", sans-serif; */font: 12px/1 Tahoma, Helvetica, Arial, "\ 5b8b \ 4f53 ", sans-serif;/* is represented by ascii characters, so that no problem occurs in any encoding */}. dropmenu {height: 34px; background: url (/uploads/allimg/0911/menu_bg.gif) repeat-x; padding-top: 4px ;}. dropmenu li {height: 34px; text-align: center ;}. dropmenu. menu_t {float: left; margin-right: 10px ;}. tlBtn {height: 29px; position: relative; line-height: 29px ;}. tl1 {width: 83px; text-align: center; padding-left: 7px ;}. tl12 {width: 71px; text-align: center; padding-left: 7px ;}. on. bLe {position: absolute; top: 0px; left: 0px; height: 29px; width: 4px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat ;}. on. bRi {position: absolute; top: 0px; right: 0px; height: 29px; width: 4px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat ;}. on. bLe {background-position: 0px 0px ;}. on. bRi {background-position:-132px 0px ;}. on {background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat-4px 0px; cursor: pointer;}/* after clicking */. click. bLe {position: absolute; top: 0px; left: 0px; height: 29px; width: 4px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat ;}. click. bRi {position: absolute; top: 0px; right: 0px; height: 29px; width: 4px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat ;}. click. bLe {background-position: 0px-42px ;}. click. bRi {background-position:-132px-42px ;}. click {background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat-4px-42px; cursor: pointer ;}. bIco {position: absolute; top: 6px; left: 4px ;}. btnMove {width: 23px; height: 14px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat-150px-42px; position: absolute; top: 7px; left: 4px ;}. btnDrop {width: 7px; height: 4px; position: absolute; top: 13px; right: 10px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat-166px-16px }. bTxt {display: block; line-height: 29px; width: 50px; height: 29px; position: absolute; top: 0px; left: 28px ;}. menu_list {position: absolute; top: 29px; left: 1px; width: 115px; border: 1px solid #99bac9; background-color: # f0f9fe; display: none; padding-left: 2px ;}. subMenu {display: none; position: absolute; left: pixel; top: 0px; width: 115px; border: 1px solid #99bac9; background-color: # f0f9fe; padding-left: 2px; z-index: 999 ;}. menu_list li {width: pixel PX; height: 20px; margin-top: 1px; margin-bottom: 1px; line-height: 20px; text-align: left; padding-left: 3px; border: 1px solid # f0f9fe ;}. li_hover {background-color: # fcf6ba ;}. menu_list li span {position: absolute; top: 7px; right: 4px; width: 4px; height: 7px; background: url (/uploads/allimg/0911/menu_sprite.gif) no-repeat-169px 0px ;}. bRi </style> <title> drop-down menu-bkjia.com </title>
Tip: the code can be modified before running!