国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

jquery仿京東導(dǎo)航/仿淘寶商城左側(cè)分類(lèi)導(dǎo)航下拉菜單效果

2019-11-20 22:46:33
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
在網(wǎng)站建設(shè)中,特別是做商城和產(chǎn)品網(wǎng)站,通常會(huì)用到導(dǎo)航彈出菜單,像是jquery寫(xiě)的仿京東導(dǎo)航菜單,一個(gè)經(jīng)典的左側(cè)多級(jí)導(dǎo)航菜單,學(xué)會(huì)了可以任意改變布局。京東菜單已經(jīng)有不少JS前端愛(ài)好者仿寫(xiě)過(guò),今天螞蟻網(wǎng)絡(luò)重新與大家分享一款仿京東商城的商品多級(jí)分類(lèi)菜單,精簡(jiǎn)版代碼
先看下jquery仿京東導(dǎo)航效果:



前端html代碼如下:
復(fù)制代碼 代碼如下:

<ul>
<li><a href="#">baidu</a></li>
<div class="tips">
<p><a >baidu</a></p>
</div>
<li>goolge</li>
<div class="tips">
<p><a >google</a></p>
</div>
<li>yahoo</li>
<div class="tips">
<p><a >yahoo</a></p>
</div>
<li>microsoft</li>
<div class="tips">
<p><a >microsoft</a></p>
</div>
</ul>

<style type="text/css">
html{color:#666;background:#FFF;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,i,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
body{font:12px/1.3 arial,helvetica,clean,sans-serif,/5b8b/4f53;}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}
table{border-collapse:collapse;border-spacing:0;}
img{border:none;}
a{text-decoration:none; color:#666;}
a:hover{text-decoration:underline; color:#FF6600;}
ul,li{list-style-type:none;}
q:before,q:after{content:'';}
sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}
/* All reset */
body{ margin:100px;}
ul li{line-height:30px; border:1px solid #E5D1A1; text-align:center; margin-top:-1px; width:200px; background:#FFFDD2; position:relative; z-index:1;}
.tips{position:absolute; width:150px; height:150px; border:1px solid #E5D1A1; background:#fff; z-index:2; display:none;}
</style>

js代碼:
復(fù)制代碼 代碼如下:

<script type="text/javascript">
$(function(){
$("ul li").each(function(index){
$(this).mouseover(function(){
var obj=$(this).offset();
var xobj=obj.left+190+"px";
var yobj=obj.top-50+"px";
$(this).css({"width":"190px","z-index":"9999","border-right":"none","background":"#fff"});
$("ul > div:eq("+index+")").css({"left":xobj,"top":yobj}).show();
}).mouseout(function(){
$("ul > .tips").hide();
$(this).css({"width":"200px","z-index":"1","border":"1px solid #E5D1A1","background":"#FFFDD2"})
})

})
$("div").each(function(){
$(this).mouseover(function(){
$(this).prev("li").css({"width":"190px","z-index":"9999","border-right":"none","background":"#fff"})
$(this).show();
}).mouseout(function(){
$(this).hide();
$(this).prev("li").css({"width":"200px","z-index":"1","border":"1px solid #E5D1A1","background":"#FFFDD2"});
})
})
})
</script>

效果圖如下,



jQuery仿京東左側(cè)菜單效果,適合商城產(chǎn)品導(dǎo)航,這里沒(méi)有做的那么細(xì),只是使用CSS結(jié)合jQuery完成了菜單的簡(jiǎn)單效果,如果需要美化,請(qǐng)您在實(shí)際應(yīng)用中自己搞一下吧,兼容性非常不錯(cuò)的,歡迎大家使用。
發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 县级市| 留坝县| 景泰县| 吉安县| 尼勒克县| 盐城市| 霍城县| 志丹县| 华阴市| 宁强县| 千阳县| 灵丘县| 荣成市| 盐边县| 定安县| 海宁市| 康平县| 志丹县| 泊头市| 墨竹工卡县| 太白县| 临清市| 兴海县| 新乡县| 广灵县| 顺昌县| 纳雍县| 廊坊市| 甘谷县| 南岸区| 嘉禾县| 会东县| 美姑县| 罗田县| 行唐县| 延寿县| 荥经县| 福贡县| 兰西县| 邹城市| 漾濞|