js 實(shí)現(xiàn)菜單上下顯示附效果圖
更新時(shí)間:2013年11月21日 11:53:29 作者:
菜單上下顯示的實(shí)現(xiàn)方法有很多,在本文將為大家介紹下使用js是如何實(shí)現(xiàn)的,需要的朋友不要錯(cuò)過(guò)
復(fù)制代碼 代碼如下:
<!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>http://flytosky.qzone.qq.com</title>
<style type="text/css">
*{font-family:"微軟雅黑"; margin:0 auto; padding:0px;}
.zj_nei_l{ width:1150px; height:130px; margin-left:25px;}
.zj_nei_l li{ float:left; font-size:20px; color:#6f6f6f; text-align:center;margin:0px 5px; list-style:none;}
.show_box .left_box,.show_box .right_box{
float:left;
height:130px;
}
.text_content p{ text-align:left; font-size:16px; color:#fff; line-height:24px; padding:10px;}
.zj_nei_l li.show_box{
width:98px;
}
.zj_nei_l li.show_box_hover{
width:522px;
}
.show_box .right_box{
display:none;
width:414px;
height:130px;
overflow:hidden;
margin-left: 10px;
}
.right_box .text_content{
width:414px;
background-color:#339933;
color:#FFF;
height:130px;
}
.zj_nei_l .left_box{
width:88px;
font-size:20px;
}
.zj_nei_l .left_box p{
line-height:42px;
font-size:20px;
}
.zj_nei_l .img_box{
width: 88px;
height:88px;
}
.show_box .item1{
background:#030;
}
.show_box .item2{
background:#300;
}
.show_box .item3{
background:#600;
}
.show_box .item4{
background:#6C0;
}
.show_box .item5{
background:#6F9;
}
.show_box .item6{
background:#3F9;
}
.show_box_hover .left_box{
color:#339933;
}
.show_box_hover .item1{
background:#0F9;
}
.show_box_hover .item2{
background:#00C;
}
.show_box_hover .item3{
background:#906;
}
.show_box_hover .item4{
background:#9F6;
}
.show_box_hover .item5{
background:#CF9;
}
.show_box_hover .item6{
background:#90F;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
</head>
<body>
<div class="zj_nei_l">
<ul>
<li class="show_box show_box_hover">
<div class="left_box">
<div class="img_box item1">
</div>
<p>學(xué)知識(shí)></p>
</div>
<div class="right_box" style="display:block;">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
<li class="show_box">
<div class="left_box">
<div class="img_box item2"></div>
<p>交摯友></p>
</div>
<div class="right_box">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
<li class="show_box">
<div class="left_box">
<div class="img_box item3"></div>
<p>能賺錢></p>
</div>
<div class="right_box">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
<li class="zj_line"></li>
<li class="show_box">
<div class="left_box">
<div class="img_box item4"></div>
<p>找業(yè)務(wù)></p>
</div>
<div class="right_box">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
<li class="show_box">
<div class="left_box">
<div class="img_box item5"></div>
<p>招人才></p>
</div>
<div class="right_box">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
<li class="show_box">
<div class="left_box">
<div class="img_box item6"></div>
<p>求發(fā)展></p>
</div>
<div class="right_box">
<div class="text_content">
<p>有事情請(qǐng)聯(lián)系小白!交志同道合的朋友</p>
<p>郵箱:flytosky1991@126.com</p>
<p>QQ:879974693</p>
</div>
</div>
<div class="clearboth"></div>
</li>
</ul>
</div>
<script type="text/javascript">
var hide_boxw = $(".right_box").width();
$(".show_box").mouseenter(function(e){
var li = $(this).find(".right_box");
$(this).addClass("show_box_hover");
if(li.css("display")=="none"){
$(".right_box").hide();
$(".show_box").removeClass("show_box_hover");
$(this).addClass("show_box_hover");
li.css({"width":"0px","display":"block"});
li.animate({"width":hide_boxw},hide_boxw);
}
});
</script>
</body>
</html>
實(shí)現(xiàn)效果
相關(guān)文章
uni-app實(shí)現(xiàn)熱更新的詳細(xì)操作步驟
隨著 App 成功上架,可能更新頻率往往會(huì)越來(lái)越高,傳統(tǒng)的應(yīng)用更新方式要求用戶重新下載并安裝應(yīng)用,這不僅耗費(fèi)用戶大量時(shí)間、流量,還嚴(yán)重影響用戶體驗(yàn),為了提升用戶體驗(yàn),熱更新技術(shù)應(yīng)運(yùn)而生,所以本文介紹了uni-app實(shí)現(xiàn)熱更新的詳細(xì)操作步驟,需要的朋友可以參考下2025-04-04
JavaScript 設(shè)計(jì)模式學(xué)習(xí) Factory
通過(guò)接口實(shí)現(xiàn)工廠,這是通過(guò)List方式顯示RSS 等實(shí)現(xiàn)代碼。2009-07-07
JavaScript雙向鏈表實(shí)現(xiàn)LFU緩存算法
本文主要介紹了JavaScript雙向鏈表實(shí)現(xiàn)LFU緩存算法,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-01-01
cloneNode實(shí)現(xiàn)表格增加刪除效果
cloneNode實(shí)現(xiàn)表格增加刪除效果...2006-11-11
js 事件對(duì)象 鼠標(biāo)滾輪效果演示說(shuō)明
第三篇,繼續(xù)總結(jié)事件對(duì)象 先看看監(jiān)聽(tīng)鼠標(biāo)滾輪事件能幫我們做什么2010-05-05
JS判斷字符串字節(jié)數(shù)并截取長(zhǎng)度的方法
這篇文章主要介紹了JS判斷字符串字節(jié)數(shù)并截取長(zhǎng)度的方法,涉及JavaScript針對(duì)頁(yè)面元素與字符串的動(dòng)態(tài)操作技巧,需要的朋友可以參考下2016-03-03
js實(shí)現(xiàn)轉(zhuǎn)盤(pán)抽獎(jiǎng)功能
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)轉(zhuǎn)盤(pán)抽獎(jiǎng)功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-03-03

