js+css實(shí)現(xiàn)扇形導(dǎo)航效果
本文實(shí)例為大家分享了js+css實(shí)現(xiàn)扇形導(dǎo)航效果的具體代碼,供大家參考,具體內(nèi)容如下\
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>扇形導(dǎo)航</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
html,body{
height: 100%;
overflow: hidden;
}
#wrap{
height: 50px;
width: 50px;
/* background-color: pink; */
position: fixed;
right: 15px;
bottom: 15px;
/* overflow: hidden; */
}
#wrap>.home{
height: 49px;
width: 49px;
/* margin: auto; */
background: url(img/home.png) ;
background-position: center;
border-radius: 50%;
transition: 1s;
position: absolute;
z-index: 1;
}
#wrap>.nav{
height: 100%;
position: relative;
}
#wrap>.nav>img{
position: absolute ;
right: 0px;
bottom: 0px;
margin: 4px;
border-radius: 50% ;
}
.home:hover{
transform: rotate(360);
}
</style>
</head>
<body>
<div id="wrap">
<div class="home"></div>
<div class="nav">
<img src="img/clos.png" >
<img src="img/full.png" >
<img src="img/open.png" >
<img src="img/prev.png" >
<img src="img/refresh.png" >
</div>
</div>
</body>
<script type="text/javascript">
window.onload =function(){
var homeEle = document.querySelector("#wrap>.home");
var flag= true;
var imgs =document.querySelectorAll("#wrap>.nav>img");
function fn(){
this.style.transition=0.3+"s";
this.style.transform ="rotate(-360deg) scale(1)";
this.style.opacity =1;
this.removeEventListener("transitionend",fn);
}
for (var i=0;i<imgs.length;i++) {
imgs[i].onclick =function(){
this.style.transform ="rotate(-360deg) scale(2)";
this.style.transition ="0.3s";
this.style.opacity =0.1;
this.addEventListener("transitionend",fn);
}
}
homeEle.onclick =function(){
console.log(imgs.length);
if(flag){
this.style.transform="rotate(-720deg) ";
imgs.forEach((index,No)=>{
imgs[No].style.right = getLocation(140,No*22.5/180*Math.PI).left+"px";
imgs[No].style.bottom = getLocation(140,No*22.5/180*Math.PI).top+"px";
imgs[No].style.transform ="rotate(-360deg) scale(1)";
imgs[No].style.transition ="1s "+No*0.1+"s";
});
}else{
this.style.transform="rotate(0)";
imgs.forEach((index,No)=>{
imgs[No].style.right = 0+"px";
imgs[No].style.bottom = 0+"px";
imgs[No].style.transform ="rotate(0deg) scale(1)";
imgs[No].style.transition="1s "+(0.4-No*0.1)+"s";
});
}
flag =!flag;
}
var getLocation =function(r,deg){
var x =Math.round(r*Math.sin(deg));
var y =Math.round(r*Math.cos(deg));
return{left:x,top:y};
}
}
</script>
</html>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- JS實(shí)現(xiàn)分頁(yè)導(dǎo)航效果
- JS實(shí)現(xiàn)滑動(dòng)導(dǎo)航效果
- JS實(shí)現(xiàn)音樂(lè)導(dǎo)航特效
- JS實(shí)現(xiàn)導(dǎo)航欄樓層特效
- JS中用三種方式實(shí)現(xiàn)導(dǎo)航菜單中的二級(jí)下拉菜單
- JS實(shí)現(xiàn)選中當(dāng)前菜單后高亮顯示的導(dǎo)航條效果
- 一個(gè)js控制的導(dǎo)航菜單實(shí)例代碼
- CSS3+Js實(shí)現(xiàn)響應(yīng)式導(dǎo)航條
- JS 實(shí)現(xiàn)導(dǎo)航欄懸停效果
- js實(shí)現(xiàn)無(wú)限級(jí)樹(shù)形導(dǎo)航列表效果代碼
相關(guān)文章
解決echarts的多個(gè)折現(xiàn)數(shù)據(jù)出現(xiàn)坐標(biāo)和值對(duì)不上的問(wèn)題
這篇文章主要介紹了解決echarts的多個(gè)折現(xiàn)數(shù)據(jù)出現(xiàn)坐標(biāo)和值對(duì)不上的問(wèn)題,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-12-12
JavaScript中push(),join() 函數(shù) 實(shí)例詳解
本文通過(guò)實(shí)例給大家介紹了JavaScript中push(),join() 的知識(shí),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09
JS獲取當(dāng)前使用的瀏覽器名字以及版本號(hào)實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇JS獲取當(dāng)前使用的瀏覽器名字以及版本號(hào)實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-08
利用uni-app和uView實(shí)現(xiàn)多圖上傳功能全過(guò)程
最近在使用uniapp開(kāi)發(fā)的微信小程序中使用了圖片上傳功能,下面這篇文章主要給大家介紹了關(guān)于利用uni-app和uView實(shí)現(xiàn)多圖上傳功能的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-03-03
每天一篇javascript學(xué)習(xí)小結(jié)(Function對(duì)象)
這篇文章主要介紹了javascript中的Function對(duì)象知識(shí)點(diǎn),對(duì)Function對(duì)象的基本使用方法,以及各種方法進(jìn)行整理,感興趣的小伙伴們可以參考一下2015-11-11

