jQuery实现的动态伸缩导航菜单实例
网络编程 2021-07-04 21:47www.168986.cn编程入门
这篇文章主要介绍了jQuery实现的动态伸缩导航菜单,实例分析了jQuery鼠标事件及animate、hide等方法的使用技巧,需要的朋友可以参考下
本文实例讲述了jQuery实现的动态伸缩导航菜单。分享给大家供大家参考。具体实现方法如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://.w3./1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>jquery select</title> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <style type="text/css"> body {padding:10px; font-family:"宋体"} * {margin:0; padding:0; font-size:12px;} a{ color: #333;} ul,li { list-style-type:none; } .menu_list li a { display:block; line-height:30px; text-align:center; height:30px; background:#e8e8e8; border-bottom:1px solid #c; } .hover { background:#e8e8e8; } .div1{ height:200px; display:none; padding:5px; } .menu_list{ width:200px; background:#f2f2f2; border:1px solid #c; } </style> <script type="text/javascript"> $(document).ready(function() { $(".menu_list ul li").click(function() { if($(this).children(".div1").is(":hidden")) //判断对象是显示还是隐藏 { if(!$(this).children(".div1").is(":animated")){ //如果当前没有进行动画,则添加新动画 $(this).children(".div1").animate({height:'show'},1000) .end().siblings().find(".div1").hide(1000);} }else{ if(!$(this).children(".div1").is(":animated")){ $(this).children(".div1").animate({height:'hide'},1000) .end().siblings().find(".div1").hide(1000);} } } ); }); </script> <div class="menu_list" id="secondpane"> <ul> <li class=""> <a href="javascript:void(0);" class="a1">网页特效</a> <div class="div1">js特效,网页特效</div> </li> <li class=""> <a href="javascript:void(0);" class="a1">网页模板</a> <div class="div1">网页模板下载</div> </li> <li class=""> <a href="javascript:void(0);" class="a1" style="border:none;">联系我们 </a> <div class="div1" style="border-:1px solid #c;">关于狼蚁SEO</div> </li> </ul> </div> </body> </html>
希望本文所述对大家的jQuery程序设计有所帮助。
上一篇:jquery实现图片左右切换的方法
下一篇:jQuery团购倒计时特效实现方法
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程