Home >
Article > Web Front-end > How to implement infinite hierarchical horizontal navigation menu with jquery_jquery
How to implement infinite hierarchical horizontal navigation menu with jquery_jquery
WBOYOriginal
2016-05-16 16:10:081553browse
The example in this article describes how jquery implements infinite hierarchical horizontal navigation menus. Share it with everyone for your reference. The specific implementation method is as follows:
Width: 700px;
}
.droplinebar ul.dropmenu {
position: relative;
}
.droplinebar ul{
width: 100%;
float: left;
font: bold 13px Arial;
background: #242c54 url(bluedefault.gif) center center repeat-x; /*default background of menu bar*/
}
.droplinebar ul li{
float:left;
}
.droplinebar ul ul {
Width: 700px;
Display:none;
z-index: 100;
position:absolute;
Left:0;
background: #303c76;
Zoom: 1;
}
.droplinebar ul li a{
float: left;
Color: white;
Padding: 9px 11px;
text-decoration: none;
Display:block;
}
.droplinebar ul li.hasmenu a img {border:none;margin-left:5px;}
.droplinebar ul li a:hover, .droplinebar ul li .current{ /*background of main menu bar links onMouseover*/
color: white;
background: transparent url(blueactive.gif) center center repeat-x;
}
/* Sub level menu links style */
.droplinebar ul li ul li a{
font: normal 13px Verdana;
padding: 6px;
padding-right: 8px;
margin: 0;
border-bottom: 1px solid navy;
}
.droplinebar ul li ul li a:hover{ /*sub menu links' background color onMouseover */
background: #242c54;
}
$(document).ready(function(){
var configs_over = 200,configs_out = 100;
$("#mydroplinemenu").find(">ul").addClass("dropmenu").find("li:has(ul)").addClass('hasmenu').find(">a" ).append("");
$('.dropmenu li.hasmenu').hover(function(){
If ($.browser.msie) {//Clear the overflow generated under IE:hidden
$(this).parent("ul").css({'overflow': 'visible'});
}
$(this).find(">ul").stop(true, true).css('top',$(this).height()).slideDown(configs_over);
},function(){
$(this).find(">ul").stop(true, true).slideUp(configs_out);
});
});
I hope this article will be helpful to everyone’s jQuery programming.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn