jQuerySmooth Navigation
Menu
jquery 达成下拉菜单,jquery下拉菜单
Jquery
是多个轻量的框架,个人认为不行好用,明日就写二个非常轻巧的例证,完毕下拉菜单功能;
第一分明要在页面引用jquery.js 版本不限 ;
接下去把=====================html贴出来:
Html代码
- <div class=”header_menu”>
- <ul>
- <li class=”menuli” id=”xtgl_menu”>系统处理</li>
- <li class=”menuli” id=”ggsq_menu”>干线管道所勤</li>
- <li class=”menuli” id=”bhz_menu”>保护站</li>
- <li class=”menuli” id=”mcjy_menu”>木材核算</li>
- <li class=”menuli” id=”slgh_menu”>森林管理和珍视</li>
- </ul>
- </div>
- <div class=”display movediv” id=”slgh_xpj线上娱乐场,menu_div”>
- <ul>
- <li class=”redli”>出勤管理</li>
- <li class=”redli”>巡视管理</li>
- <li class=”redli”>现场取证</li>
- <li class=”redli”>难题处置</li>
- 实现下拉菜单,30个Web下拉菜单。 </ul>
- </div>
- <div class=”display movediv” id=”mcjy_menu_div”>
- <ul>
- <li class=”redli”>地点监测</li>
- <li class=”redli”>查验处理</li>
- </ul>
- </div>
- <div class=”display movediv” id=”bhz_menu_div”>
- <ul>
- <li class=”redli”>出勤管理</li>
- <li class=”redli”>监管消息</li>
- </ul>
- </div>
- <div class=”display movediv” id=”ggsq_menu_div”>
- <ul>
- <li class=”redli”>出勤处理</li>
- <li class=”redli”>幽禁音讯</li>
- </ul>
- </div>
- <div class=”display movediv” id=”xtgl_menu_div”>
- <ul>
- <li class=”redli”>权限管理</li>
- <li class=”redli”>设备管理</li>
- </ul>
- </div>
===========================css样式:
Css代码
- /**尾部菜单**/
- .header_menu{
- float:right;
- width: 50%;
- height: 100%;
- cursor: pointer;
- }
- .header_menu ul{
- list-style: none;
- height: 100%;
- }
- .header_menu ul li{
- float: right;
- width: 20%;
- color:white;
- font-size:14px;
- padding-top: 55px;
- font-weight: bold;
- }
- .display{
- display: none;
- }
- .display ul{
- list-style: none;
- width: 100px;
- }
- .display ul li{
- padding-top:10px;
- padding-bottom: 5px;
- padding-left:5px;
- cursor: pointer;
- font-size: 14px;
- }
- .movediv{
- position: fixed;
- left: 0px;
- top:0px;
- font-size: 14px;
- white;
- border:1px solid white;
- }
- .redcolor{
- #a0c9e6;
- }
=======================js脚本
Js代码
- $(function() {
- // 菜单绑定事件
- initMenuListener();
- // 下拉菜单绑定事件
- initSubMenuHover();
- // 下拉菜单颜色改换
- initSubMenuLiHover();
- });
- /**
- * 尾部菜单绑定滑过事件
- */
- function initMenuListener() {
- $(“.menuli”).hover(function() {
- var hideDivId = $(this).attr(“id”) + “_div”;
- // 得到菜单的职责
- var left = $(this).offset().left;
- var top = $(this).offset().top;
- var height = $(this).outerHeight();//outerHeight是赢得高度,满含内边距,height是也是获取中度,但是只包涵文件中度
- $(“#” + hideDivId).show();
- $(“#” + hideDivId).css(“left”, left);
- $(“#” + hideDivId).css(“top”, top + height);
- }, function() {
- // 将原先的菜系掩饰
- $(“.display”).hide();
- });
- }
- /**
- * 下拉菜单绑定事件
- */
- function initSubMenuHover() {
- $(“.display”).hover(function() {
- $(this).show();
- }, function() {
- $(this).hide();
- });
- }
- /**
- * 下拉菜单更改颜色
- */
- function initSubMenuLiHover() {
- $(“.redli”).hover(function() {
- $(this).addClass(“redcolor”);
- }, function() {
- $(this).removeClass(“redcolor”);
- });
- }
效果与利益如下:
jquery达成下拉菜单
达成下拉菜单,jquery下拉菜单 Jquery
是一个轻量的框架,个人感觉相当好用,前天就写四个特别简单的例子,达成下拉菜单功能;
首先…
jQuery
Smooth Navigation Menu
Simple Drop Down Menu
Plugin
Simple Drop Down Menu Plugin
Dropdown, iPod Drilldown, and Flyout styles
Dropdown, iPod Drilldown, and Flyout
styles
jQuery and CSS Example
Create the Fanciest Drop Down Menu You Ever Saw
A Different Top Navigation
jQuery and CSS
Example
Simple jQuery Dropdowns
Sexy Drop Down Menu with jQuery and CSS
Create the Fanciest Drop Down Menu You Ever
Saw
How to Create a Drop Down Nav Menu with HTML5, CSS3, and jQuery
Reinventing a Drop Down with CSS and jQuery
A Different Top
Navigation
Superfish
Animated Drop Down Menu with jQuery
Simple jQuery
Dropdowns
jQuery Menu: Dropdown, Drilldown, and iPod Flyout Styles
McDropdown jQuery Plugin
Sexy Drop Down Menu with jQuery and
CSS
Mega Drop Down Menus with CSS & jQuery
Sliding jQuery Menu
How to Create a Drop Down Nav Menu with HTML5, CSS3, and
jQuery
jdMenu Hierarchical Menu Plugin
Dim Gray Drop Down Menu
Reinventing a Drop Down with CSS and
jQuery