龙空技术网

web前端扇形导航优化:增加addEventListener

一刀coder 342

前言:

眼前小伙伴们对“js的addeventlistener函数三个参数的作用”大约比较注重,兄弟们都想要学习一些“js的addeventlistener函数三个参数的作用”的相关内容。那么小编在网络上汇集了一些对于“js的addeventlistener函数三个参数的作用””的相关资讯,希望姐妹们能喜欢,同学们一起来学习一下吧!

1.三角函数sin、cos、对边x轴、邻边y轴计算原理2.less实现

* {    margin: 0;    padding: 0;    body {        height: 100%;        overflow: hidden;        #wrap {            width: 300px;            height: 300px;            background: seagreen;            color: white;            font: 50px/300px "微软雅黑";            text-align: center;            border-radius: 50%;            top: 25%;            left: 25%;            margin: auto;            position: absolute;            transition: 2s;        }        &:hover #wrap {            background: skyblue;        }        #sector-nav {            width: 50px;            height: 50px;            //fixed:固定位置,默认left/top right/bottom:auto,生效需要指定值为0            position: fixed;            top: 0;            left: 0;            right: 0;            bottom: 0;            margin: auto;            .sector-nav-home {                //一旦定位position:absolute绝对定位,那么宽高依赖内容,将被内容撑开                position: absolute;                border-radius: 50%;                z-index: 1; //最顶层                //position后,需要定义宽高                height: 100%;                width: 100%;                background: url(../img/home.png) no-repeat;                transition: 2s;            }            .sector-nav-inner {                height: 100%;                img {                    position: absolute;                    border-radius: 50%;                    //居中,图片为42*42px,上下左右各空4个位置                    margin: 4px;                    //设置每个tag默认位置,这里为null,首次点击不会出现的过渡的bug                    left: 0;                    top: 0;                }            }        }    }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
3.css压缩
* {  margin: 0;  padding: 0;}* body {  height: 100%;  overflow: hidden;}* body #wrap {  width: 300px;  height: 300px;  background: seagreen;  color: white;  font: 50px/300px "微软雅黑";  text-align: center;  border-radius: 50%;  top: 25%;  left: 25%;  margin: auto;  position: absolute;  transition: 2s;}* body:hover #wrap {  background: skyblue;}* body #sector-nav {  width: 50px;  height: 50px;  position: fixed;  top: 0;  left: 0;  right: 0;  bottom: 0;  margin: auto;}* body #sector-nav .sector-nav-home {  position: absolute;  border-radius: 50%;  z-index: 1;  height: 100%;  width: 100%;  background: url(../img/home.png) no-repeat;  transition: 2s;}* body #sector-nav .sector-nav-inner {  height: 100%;}* body #sector-nav .sector-nav-inner img {  position: absolute;  border-radius: 50%;  margin: 4px;  left: 0;  top: 0;}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
4.html映射
<!DOCTYPE html><html>	<head>		<meta charset="UTF-8">		<title>扇形导航增强版</title>	</head>	<body>		<div id="wrap">cevent</div>		<div id="sector-nav">			<div class="sector-nav-home">							</div>			<div class="sector-nav-inner">				<img src="img/clos.png" alt="关闭"/>				<img src="img/full.png" alt="全屏"/>				<img src="img/open.png" alt="打开"/>				<img src="img/prev.png" alt="后退"/>				<img src="img/refresh.png" alt="刷新"/>			</div>		</div>	</body>	<link rel="stylesheet" href="css/sector-navigate-pro.css" />	<script type="text/javascript" src="js/sector-navigate-pro.js"></script></html>12345678910111213141516171819202122232425
5.效果图

标签: #js的addeventlistener函数三个参数的作用