jQuery实现的精美平滑二级下拉菜单效果代码
沧海小强 人气:0本文实例讲述了jQuery实现的精美平滑二级下拉菜单效果。分享给大家供大家参考,具体如下:
这是一款jQurey实现的向下二级导航菜单效果。效果非常不错,由上到下平滑延伸,给人的感觉协调唯美!js与html代码结构简单明了,便于使用与修改!
运行效果截图如下:
具体代码如下:
<!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=utf-8" /> <title>jQuery实现精美二级菜单——js特效大全</title> <style type="text/css"> * { margin:0; padding:0; } body { font:12px/normal Arial, Helvetica, sans-serif; } ul, ol { list-style:none; } a img { border:none; } #content { width:800px; margin:30px auto; } .main_nav { width:100%; height:30px; } .main_nav ul li { float:left; width:190px; height:30px; border-right:1px solid #666; position:relative; } .main_nav ul li a { display:block; height:30px; line-height:30px; text-align:center; background:#333; color:#ccc; text-decoration:none; } .main_nav ul li dl { position:absolute; left:0; top:30px; width:190px; display:none; } .main_nav ul li dl dd { height:31px; } .main_nav ul li dl dd a { display:block; height:30px; line-height:30px; text-align:center; color:white; background:#555; border-bottom:1px solid #666; } .main_nav ul li dl dd a:hover { background:#333; color:#ccc; } .click { margin-top:200px; } </style> </head> <body> <div id="content"> <div class="main_nav hover"> <ul> <li><a href="#" title="js特效大全">网页特效</a> <dl> <dd><a href="#" title="js特效大全">网页特效</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页特效</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页特效</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页特效 </a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页特效</a><https://img.qb5200.com/download-x/dd> <https://img.qb5200.com/download-x/dl> </li> <li><a href="#" title="js特效大全">网页设计</a> <dl> <dd><a href="#" title="js特效大全">网页设计</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计 </a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计 </a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页设计 </a><https://img.qb5200.com/download-x/dd> <https://img.qb5200.com/download-x/dl> </li> <li><a href="#" title="">网页制作</a> <dl> <dd><a href="#" title="js特效大全">网页制作</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页制作</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页制作</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页制作 </a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网页制作</a><https://img.qb5200.com/download-x/dd> <https://img.qb5200.com/download-x/dl> </li> <li><a href="#" title="">网站优化</a> <dl> <dd><a href="#" title="js特效大全">网站优化</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网站优化</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网站优化</a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网站优化 </a><https://img.qb5200.com/download-x/dd> <dd><a href="#" title="js特效大全">网站优化</a><https://img.qb5200.com/download-x/dd> <https://img.qb5200.com/download-x/dl> </li> </ul> </div> </div> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(".hover ul li").hover(function(){ $(this).children("dl").slideDown(300) }, function(){ $(this).children("dl").slideUp(100) }); </script> </body> </html>
希望本文所述对大家jQuery程序设计有所帮助。
加载全部内容