基于hover的用法實(shí)例(推薦)
//hover,鼠標(biāo)移入移出的另一種用法
<!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>左導(dǎo)航特效</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">購(gòu)物特權(quán)</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" >俱樂(lè)部包郵卡</a></li>
<li class="jwljb"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >購(gòu)物領(lǐng)金幣</a></li>
<li class="mrljb"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >每日領(lǐng)金幣</a></li>
<li class="vipjtj"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >VIP階梯價(jià)</a></li>
</ul>
</div>
</div>
</body>
</html>
以上這篇基于hover的用法實(shí)例(推薦)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
IE8兼容Jquery.validate.js的問(wèn)題
本文主要介紹IE8兼容Jquery.validate.js兼容問(wèn)題并提供哦了解決方法。需要的朋友來(lái)看下吧2016-12-12
再分享70+免費(fèi)的jquery 圖片滑塊效果插件和教程
這些jQuery插件同樣可以實(shí)現(xiàn)圖片和內(nèi)容的滑塊效果。下面的這些jQuery插件的Demo網(wǎng)站我都測(cè)試了一些,都可以正常訪問(wèn),我相信那么多款插件中總會(huì)有你喜歡的2014-12-12
使用jquery局部刷新(jquery.load)從數(shù)據(jù)庫(kù)取出數(shù)據(jù)
jquery提供了很好的ajax交互,我這里用的是直接返回字符串,用的是jquery.load方法從數(shù)據(jù)庫(kù)取出的數(shù)據(jù)2014-01-01
jQuery中[attribute]選擇器用法實(shí)例
這篇文章主要介紹了jQuery中[attribute]選擇器用法,以實(shí)例形式分析了[attribute]選擇器的功能、定義及匹配給定元素屬性的技巧,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2014-12-12
JQuery通過(guò)Ajax提交表單并返回結(jié)果
在開始介紹使用JQuery提交表單之前,先看一下非Ajax提交表單的形式2011-07-07
jQuery實(shí)現(xiàn)無(wú)限往下滾動(dòng)效果代碼
這篇文章主要介紹了jQuery實(shí)現(xiàn)無(wú)限往下滾動(dòng)效果代碼,涉及jQuery基于ajax交互操作數(shù)據(jù)庫(kù)數(shù)據(jù)及頁(yè)面元素動(dòng)態(tài)變換的相關(guān)技巧,需要的朋友可以參考下2016-04-04
基于jQuery+Cookie實(shí)現(xiàn)的防止刷新的在線考試倒計(jì)時(shí)
這篇文章主要介紹了基于jQuery+Cookie實(shí)現(xiàn)的防止刷新的在線考試倒計(jì)時(shí)的方法和示例,有需要的小伙伴可以參考下2015-06-06
Jquery回調(diào)對(duì)象與延遲對(duì)象用法詳解
本文詳細(xì)講解了Jquery回調(diào)對(duì)象與延遲對(duì)象的用法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-05-05

