基于hover的用法实例(推荐)
更新时间:2017年07月04日 08:30:37 投稿:jingxian
下面小编就为大家带来一篇基于hover的用法实例(推荐)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
//hover,鼠标移入移出的另一种用法
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>左导航特效</title> <style type="text/css"> * { margin: 0px; padding: 0px; font-size: 12px; } #nav .navsBox { width: 160px; } #nav .navsBox .firstNav { height:45px; line-height:45px; background-color:#EBEBEB; border-left:10px solid #FE705C; padding-left:20px; width:130px; font-weight:bold; cursor: pointer; } #nav .navsBox ul { display:none; list-style:none; } #nav .navsBox ul li { display:block; height:45px; line-height:45px; padding-left:70px; width:90px; background-color:#F2F2F2; background-position:33px 7px; background-repeat:no-repeat; } #nav .navsBox ul li.jedh { background-image:url("./images/huan.gif"); } #nav .navsBox ul li.jlbbyk { background-image:url("./images/you.gif"); } #nav .navsBox ul li.jwljb { background-image:url("./images/gouwu.gif"); } #nav .navsBox ul li.mrljb { background-image:url("./images/meiri.gif"); } #nav .navsBox ul li.vipjtj { background-image:url("./images/zhe.gif"); } #nav .navsBox ul li.onbg { background-color:#F9DBD1; } #nav .navsBox ul li a { color:#000; text-decoration:none; } </style> <script src="js/jquery-1.11.3.min.js"></script> <script> $(function () { $(".firstNav").click(function () { var $ul= $(this).next(); if($ul.is(":visible")){ $ul.hide(); }else{ $ul.show(); $ul.children().hover(function () { $(this).addClass("onbg"); },function () { $(this).removeClass("onbg") }) } }) }) </script> </head> <body> <div id="nav"> <div class="navsBox"> <div class="firstNav">购物特权</div> <ul> <li class="jedh"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >全额兑换</a></li> <li class="jlbbyk"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >俱乐部包邮卡</a></li> <li class="jwljb"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >购物领金币</a></li> <li class="mrljb"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >每日领金币</a></li> <li class="vipjtj"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >VIP阶梯价</a></li> </ul> </div> </div> </body> </html>
以上这篇基于hover的用法实例(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
Jquery设置attr的disabled属性控制某行显示或者隐藏
这篇文章主要与大家分享Jquery设置attr的disabled属性控制某行显示或者隐藏的具体实现,喜欢的朋友可以参考下2014-09-09基于jQuery和CSS3制作数字时钟附源码下载(jquery篇)
本篇文章基于jquery让数字时钟真正的跑起来,实现一个带有日期和星期的网页版数字时钟,效果非常逼真,感兴趣的朋友一起看看吧2015-11-11jquery异常问题Uncaught TypeError: $(...).on is not a funct
这篇文章主要介绍了jquery异常问题Uncaught TypeError: $(...).on is not a function,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2022-11-11jQuery Validation实例代码 让验证变得如此容易
众所周知,Jquery以其简洁性让无数人为之疯狂。现在我要像大家介绍一个jQuery Validation,一看到Validation大家肯定第一直观感觉就是这肯定是一个验证框架,没有错,本文就是基于jQuery Validation展开讨论。2010-10-10jQuery插件multiScroll实现全屏鼠标滚动切换页面特效
本文给大家分享的是一款jQuery整屏(全屏)滚动插件网页特效,滚动鼠标滚轮整屏一屏滚动切换代码,可设置文字/图片绝对上下左右居中显示JS代码,时下最流行的jQuery全屏滚动插件!(兼容测试:IE6及以上、Firefox、Chrome、Opera、Safari、360等主流浏览器)2015-04-04
最新评论