jquery+CSS3實(shí)現(xiàn)淘寶移動(dòng)網(wǎng)頁(yè)菜單效果
本文實(shí)例講述了jquery+CSS3實(shí)現(xiàn)淘寶移動(dòng)網(wǎng)頁(yè)菜單效果。分享給大家供大家參考。具體如下:
這是一款基于jquery+CSS3實(shí)現(xiàn)的淘寶移動(dòng)網(wǎng)頁(yè)菜單,其實(shí)這個(gè)菜單動(dòng)畫(huà)并不復(fù)雜,只有縮放和位移。難點(diǎn)是用了扇形結(jié)構(gòu),而且還要實(shí)現(xiàn)扇形的鏈接區(qū)域,這個(gè)就費(fèi)腦筋了,最后采用了傳統(tǒng)的圖片map來(lái)做熱區(qū),效果還不錯(cuò)。相信肯定有更好的解決方法。
先來(lái)看看運(yùn)行效果截圖:

在線(xiàn)演示地址如下:
http://demo.jb51.net/js/2015/jquery-css3-taobao-phone-menu-codes/
具體代碼如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3實(shí)現(xiàn)淘寶移動(dòng)網(wǎng)頁(yè)菜單</title>
<script src="jquery-1.6.2.min.js"></script>
<style type="text/css">
body { background: #f5f5f5; }
ul, li,img { margin: 0; padding: 0; list-style: none; border:0;}
a { outline:none;}
.phone { width:350px; height:600px; border:#000 solid 1px; position:absolute;}
.plate { width: 281px; height: 281px; border-radius:50%; padding:6px; background:rgba(0,0,0,0.2); overflow: hidden; position: absolute; bottom:0; left:0;}
.link { width: 100%; height: 100%; position: absolute; }
.sector { width: 281px; height: 281px; overflow: hidden; background: url(images/bg.png); position: absolute; }
.sector li { position: absolute; width: 50%; height: 50%; overflow: hidden; }
.sector a { position: absolute; width: 100%; height: 100%; border-top-left-radius: 100%; line-height: 999px; -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); margin: -25px 0 0 45px; background: #ff4400; display:none; }
.sector li.r2 { -webkit-transform: rotate(60deg); -moz-transform: rotate(60deg); margin: -26px 0 0 96px; }
.sector li.r3 { -webkit-transform: rotate(120deg); -moz-transform: rotate(120deg); margin: 44px 0 0 166px; }
.sector li.r4 { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); margin: 140px 0 0 140px; }
.sector li.r5 { -webkit-transform: rotate(240deg); -moz-transform: rotate(240deg); margin: 166px 0 0 44px; }
.sector li.r6 { -webkit-transform: rotate(300deg); -moz-transform: rotate(300deg); margin: 96px 0 0 -26px; }
.icon { position: absolute; }
.icon li { position: absolute; width: 44px; height: 37px; background: #ccc; overflow: hidden; line-height: 999px; background: url(images/icon.png); display: none; }
.icon li.r1 { margin: 37px 0 0 71px; background-position: 0 -37px; }
.icon li.r2 { margin: 37px 0 0 168px; background-position: -220px -37px;}
.icon li.r3 { margin: 122px 0 0 214px; background-position: -176px -37px;}
.icon li.r4 { margin: 204px 0 0 165px; background-position: -132px -37px; }
.icon li.r5 { margin: 208px 0 0 76px; background-position: -88px -37px; }
.icon li.r6 { margin: 120px 0 0 21px; background-position: -44px -37px;}
.home { width:138px; height:138px; overflow:hidden; line-height:999px; position:absolute; border-radius:50%; left:50%; top:50%; margin:-69px 0 0 -69px;}
.home.over a { display:block; background:#ff4400; width:125px; height:125px; border-radius:50%; margin:7px;}
.home.over a span { display:block; width:53px; height:46px; position:relative; margin:auto; top:40px;}
.menu { position:absolute; bottom:25px; left:25px;}
.menu a { display:block; width:60px; height:60px; border-radius:50%; background:#ff4400; border:#fff solid 5px; box-shadow: 0 0 0 3px rgba(200,200,200,0.3);}
.menu a span { background:url(images/icon.png) no-repeat -264px -46px; display:block; width:41px; height:31px; overflow:hidden; line-height:999px; margin:14px 0 0 9px;}
/*菜單動(dòng)畫(huà)*/
.plate {
-webkit-transition:all 0.3s;
transition:all 0.3s;
-webkit-transform:translate(-100px,100px) scale(0,0) rotate(0);
transform:translate(-100px,100px) scale(0,0) rotate(0);
}
.plate.open {
-webkit-transform:translate(28px,-100px) scale(1,1) rotate(360deg);
transform:translate(28px,-100px) scale(1,1) rotate(360deg);
}
.menu a {
-webkit-transition:all 0.3s;
transition:all 0.3s;
}
.menu a.open { background:rgba(200,200,200,0.5);}
</style>
</head>
<body>
<p>若動(dòng)畫(huà)不流暢請(qǐng)刷新一下頁(yè)面</p>
<div class="phone">
<div class="plate">
<ul class="sector">
<li class="r1"><a href="#">我的淘寶</a></li>
<li class="r2"><a href="#">購(gòu)物車(chē)</a></li>
<li class="r3"><a href="#">搜索</a></li>
<li class="r4"><a href="#">更多</a></li>
<li class="r5"><a href="#">物流</a></li>
<li class="r6"><a href="#">旺旺</a></li>
</ul>
<ul class="icon">
<li class="r1">我的淘寶</li>
<li class="r2">購(gòu)物車(chē)</li>
<li class="r3">搜索</li>
<li class="r4">更多</li>
<li class="r5">物流</li>
<li class="r6">旺旺</li>
</ul>
<div class="home"><a href="#"><span>主頁(yè)</span></a></div>
<div class="link"><img src="images/link.png" width="100%" height="100%" usemap="#Map">
<map name="Map" id="map">
<area shape="poly" coords="140,67,139,1,72,21,25,68,85,107" href="#a">
<area shape="poly" coords="196,105,256,74,213,23,141,5,142,73" href="#b">
<area shape="poly" coords="196,106,257,75,277,132,260,208,198,174" href="#c">
<area shape="poly" coords="195,173,258,211,214,259,144,279,141,205" href="#d">
<area shape="poly" coords="141,203,136,279,68,256,21,208,86,174" href="#e">
<area shape="poly" coords="84,169,18,206,2,131,22,72,83,108" href="#f">
<area shape="circle" coords="141,140,63" href="#home">
</map>
</div>
</div>
<div class="menu">
<a href="#taobao"><span>淘寶</span></a>
</div>
</div>
<script>
$("#map area[shape='poly']").hover(function(){
i = $(this).index();
$(".sector a").eq(i).show();
$(".icon li").eq(i).show();
},function(){
$(".sector a").eq(i).hide();
$(".icon li").eq(i).hide();
});
$("#map area[shape='circle']").hover(function(){
$(".home").addClass("over");
},function(){
$(".home").removeClass("over");
});
$(".menu a").click(function(){
if($(this).attr("class") == "open"){
$(this).removeClass("open");
$(this).addClass("close");
$(".plate").removeClass("open");
$(".plate").addClass("close");
}else{
$(this).removeClass("close");
$(this).addClass("open");
$(".plate").removeClass("close");
$(".plate").addClass("open");
}
});
</script>
</body>
</html>
希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。
相關(guān)文章
Jquery UI震動(dòng)效果實(shí)現(xiàn)原理及步驟
如果你想你的博客頁(yè)面某些部分引起讀者的注意,你可以使這些部分震動(dòng),如廣告等等,今天這篇文章將介紹怎樣使你的頁(yè)面中的元素震動(dòng)起來(lái),感興趣的你可不要錯(cuò)過(guò)了哦,或許對(duì)你學(xué)習(xí)jquery ui 有所幫助2013-02-02
jQuery的animate函數(shù)學(xué)習(xí)記錄
jQuery.animate的每種動(dòng)畫(huà)過(guò)渡效果都是通過(guò)easing函數(shù)實(shí)現(xiàn)的,下面是自己研究之后對(duì)其的基本認(rèn)識(shí)2014-08-08
Jquery ajax執(zhí)行順序 返回自定義錯(cuò)誤信息(實(shí)例講解)
由于Jquery中的Ajax的async默認(rèn)是true(異步請(qǐng)求),如果想一個(gè)Ajax執(zhí)行完后再執(zhí)行另一個(gè)Ajax, 需要把a(bǔ)sync=false就可以了2013-11-11
CSS+jQuery實(shí)現(xiàn)的一個(gè)放大縮小動(dòng)畫(huà)效果
因?yàn)樾枨缶椭挥?個(gè)元素。如果是要用CSS的class來(lái)處理,那就需要用到CSS3動(dòng)畫(huà)了,好了下面為大家介紹下如何實(shí)現(xiàn)這個(gè)放大縮小動(dòng)畫(huà)效果2013-09-09
jQuery實(shí)現(xiàn)的監(jiān)聽(tīng)導(dǎo)航滾動(dòng)置頂狀態(tài)功能示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)的監(jiān)聽(tīng)導(dǎo)航滾動(dòng)置頂狀態(tài)功能,涉及基于jQuery的事件響應(yīng)及狀態(tài)監(jiān)聽(tīng)等相關(guān)操作技巧,需要的朋友可以參考下2018-07-07
js jquery獲取當(dāng)前元素的兄弟級(jí) 上一個(gè) 下一個(gè)元素
js獲取方法要比jq的方法麻煩的多,主要是因?yàn)镕F瀏覽器,因?yàn)镕F瀏覽器也會(huì)把換行當(dāng)作dom元素,下面跟著小編一起來(lái)學(xué)習(xí)js jquery獲取當(dāng)前元素的兄弟級(jí) 上一個(gè) 下一個(gè)元素的,需要的朋友一起來(lái)學(xué)習(xí)吧2015-09-09
淺析jquery數(shù)組刪除指定元素的方法:grep()
下面小編就為大家?guī)?lái)一篇淺析jquery數(shù)組刪除指定元素的方法:grep()。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
jQuery內(nèi)容選擇器與表單選擇器實(shí)例分析
這篇文章主要介紹了jQuery內(nèi)容選擇器與表單選擇器,結(jié)合實(shí)例形式分析了jQuery內(nèi)容選擇器與表單選擇器的功能、用法及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下2019-06-06

