2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > php实现鼠标悬停显示下拉菜单 jquery实现鼠标滑过显示二级下拉菜单效果

php实现鼠标悬停显示下拉菜单 jquery实现鼠标滑过显示二级下拉菜单效果

时间:2018-09-06 13:16:10

相关推荐

php实现鼠标悬停显示下拉菜单 jquery实现鼠标滑过显示二级下拉菜单效果

本文实例讲述了jquery实现鼠标滑过显示二级下拉菜单效果。分享给大家供大家参考。具体如下:

这是一款jquery实现的下拉菜单,当鼠标移在主菜单上的时候,向下滑出二级子菜单,采用UL LI结构,便于修改完善,我觉得是很实用的菜单,希望大家平时能用得上。

运行效果截图如下:

在线演示地址如下:

具体代码如下:

jquery下拉菜单

* { margin: 0; padding: 0; }

body {font-family: Arial, Tahoma, sans-serif; font-size: 11px; color: #232323; }

.wrap { width: 800px; margin: 0 auto; }

#nav { margin: 0; padding: 0; list-style: none; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; border-bottom: 1px solid #d5dce8; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; height: 50px; padding-left: 15px; padding-right: 15px; background: #edf3f7; }

#nav li { float: left; display: block; background: none; position: relative; z-index: 999; margin: 0 1px; }

#nav li a { display: block; padding: 0; font-weight: 700; line-height: 50px; text-decoration: none; color: #818ba3; zoom: 1; border-left: 1px solid transparent; border-right: 1px solid transparent; padding: 0px 12px; }

#nav li a:hover, #nav li a.hov { background-color: #fff; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; color: #576482; }

#nav ul { position: absolute; left: 1px; display: none; margin: 0; padding: 0; list-style: none; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.2); -o-box-shadow: 0 1px 3px rgba(0,0,0,0.2); box-shadow: 0 1px 3px rgba(0,0,0,0.2); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2); padding-bottom: 3px; }

#nav ul li { width: 180px; float: left; border-top: 1px solid #fff; text-align: left; }

#nav ul li:hover { border-left: 0px solid transparent; border-right: 0px solid transparent; }

#nav ul a { display: block; height: 20px; line-height: 20px; padding: 8px 5px; color: #666; border-bottom: 1px solid transparent; text-transform: uppercase; color: #797979; font-weight: normal; }

#nav ul a:hover { text-decoration: none; border-right-color: transparent; border-left-color: transparent; background: transparent; color: #4e4e4e; }

* html #nav ul { margin: 0 0 0 -2px; }

.clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }

.clearfix { display: inline-block; }

html[xmlns] .clearfix { display: block; }

* html .clearfix { height: 1%; }

网站主页关于我CompanyAuthorsAdvertisingRSS订阅PSDPatternsIcons精美博文HTML5CSS3jQueryMySQLWeb工具PerformanceCMS PluginsCheat SheetsOriginalsWebsite DesignMobile

$(document).ready(function() {

$('#nav li').hover(function() {

$('ul', this).slideDown(200);

$(this).children('a:first').addClass("hov");

}, function() {

$('ul', this).slideUp(100);

$(this).children('a:first').removeClass("hov");

});

});

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。