jQuery实现点击后高亮背景固定显示的菜单效果【附demo源码下载】
jQuery实现点击后高亮背景固定显示的菜单效果【附demo源码下载】
发布时间:2016-12-30 来源:查字典编辑
摘要:本文实例讲述了jQuery实现点击后高亮背景固定显示的菜单效果。分享给大家供大家参考,具体如下:jquery实现点击后高亮背景的菜单特效*{...

本文实例讲述了jQuery实现点击后高亮背景固定显示的菜单效果。分享给大家供大家参考,具体如下:

<!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实现点击后高亮背景的菜单特效</title> <style> *{ margin:0; padding:0; list-style:none;} body{ font:normal 14px/24px 'MicroSoft YaHei';} .cotrs{ width:960px; height:32px; line-height:32px; background:#999; margin:0 auto;} .cotrs a{ height:32px; line-height:32px; color:#fff; text-decoration:none; padding:0px 10px; display:block; float:left;} .cotrs a:hover{ text-decoration:none; background:#000;} .cotrs a.thisclass{text-decoration:none; background:#000;} </style> </head> <body> <br><br><br> <div> <a href='javascript:'>首页</a> <a href='javascript:'>菜单导航</a> <a href='javascript:'>时间日期</a> <a href='javascript:'>焦点图</a> <a href='javascript:'>tab标签</a> <a href='javascript:'>jquery特效</a> <a href='javascript:'>在线客服</a> <a href='javascript:'>广告代码</a> <a href='javascript:'>相册代码</a> <a href='javascript:'>图片特效</a> <a href='javascript:'>名站特效</a> <a href='javascript:'>其他代码</a> <a href='javascript:'>HTML5</a> </div> <script src="jquery-1.7.2.min.js"></script> <script> $(function(){ var cotrs = $(".cotrs a"); cotrs.click(function(){ $(this).addClass("thisclass").siblings().removeClass("thisclass"); }); }); </script> </body> </html>

运行效果图如下:

jQuery实现点击后高亮背景固定显示的菜单效果【附demo源码下载】1

完整实例代码点击此处本站下载。

希望本文所述对大家jQuery程序设计有所帮助。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类