TweenMax实现悬浮按钮点击上面弹出子菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:TweenMax实现悬浮按钮点击上面弹出子菜单效果代码

代码标签: TweenMax 悬浮 按钮 点击 上面 弹出 子菜单

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">
<style>
    @import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap");
	html,body {
	height:100%;
}
body {
	display:flex;
	align-items:center;
	justify-content:center;
	color:white;
	font-family:"Montserrat";
}
ul,li {
	list-style-type:none;
}
ul {
	padding-left:0;
	font-size:0.875em;
}
li {
	margin:15px auto;
	padding:15px 0px;
	border-bottom:1px solid rgba(175,175,175,0.25);
}
li:last-child {
	border:none;
}
a {
	display:inline-block;
	text-decoration:none;
	color:white;
	display:flex;
	align-items:center;
}
h3 {
	font-size:20px;
}
.container {
	text-align:center;
}
.menu-btn {
	border:none;
	background:linear-gradient(120deg,#f829ab 25%,#f42977 75%,#f41f5f 100%);
	border-radius:25px;
	-webkit-transform:rotate(-45deg) translateZ(0);
	transform:rotate(-45deg) translateZ(0);
	width:70px;
	height:70px;
	position:relative;
	cursor:pointer;
	box-shadow:0px 2px 20px rgba(244,31,95,0.25);
	margin:15px auto;
}
.menu-btn:focus {
	outline:none;
}
.menu-btn:before,.menu-btn:after {
	content:"";
	position:absolute;
	top:calc(50% - 1px);
	left:calc(50% - 17px);
	width:34px;
	height:2px;
	background:white;
	transition:0.3s ease all;
	-webkit-transform:rotate(-45deg) translateZ(0);
	transform:rotate(-45deg) translateZ(0);
}
.menu-btn:after {
	-webkit-transform:rotate(45deg) translateZ(0);
	transform:rotate(45deg) translateZ(0);
}
.menu-btn.open:before {
	-webkit-transform:rotate(0deg);
	transform:rotate(0deg);
}
.menu-btn.open:after {
	-webkit-transform:rotate(90deg);
	transform:rotate(90deg);
}
.menu {
	position:relative;
	min-height:250px;
	min-width:300px;
	margin:15px auto;
	border-radius:24px 24px 24px 4px;
	text-align:left;
	padding:15px 20px;
	-webkit-transform:scale(0);
	transform:scale(0);
	-webkit-transform-origin:50% 50%;
	transform-origin:50% 50%;
	transition:0.35s ease all;
	overflow:hidden;
}
.menu >h3 {
	opacity:0;
}
.menu >ul >li {
	opacity:0;
}
.menu:before {
	content:"";
	position:absolute;
	top:0;
	left:0;
	height:100%;
	width:100%;
	background:#28334b;
	z-index:-1;
	border-radius:50%;
	-webkit-transform:scale(0.5);
	transform:scale(0.5);
}
.menu.active:before {
	-webkit-animation:0.2s menuIn 0.15s normal forwards;
	animation:0.2s menuIn 0.15s normal forwards;
	-webkit-animation-timing-function:ease-in;
	animation-timing-function:ease-in;
}
.active {
	-webkit-transform:scale(1);
	transform:scale(1);
}
.menu.active >h3 {
	transition:0.2s ease-in 0.2s;
	opacity:1;
}
.menu.active >ul >li {
	transition:0.2s ease-in 0.2s;
	opacity:1;
}
@-webkit-keyframes menuIn {
	0% {
	-webkit-transform:scale(0.5);
	transform:scale(0.5);
	border-radius:50%;
}
45% {
	-webkit-transform:scale(1.25);
	transform:scale(1.25);
	border-radius:50%;
}
100% {
	-webkit-transform:scale(1);
	transform:scale(1);
	border-radius:24px 24px 24px 4px;
}
}@keyframes menuIn {
	0% {
	-webkit-transform:scale(0.5);
	transform:scale(0.5);
	border-radius:50%;
}
45% {
	-webkit-transform:scale(1.25);
	transform:scale(1.25);
	border-radius:50%;
}
100% {
	-webkit-transform:scale(1);
	transform:scale(1);
	border-radius:24px 24px 24px 4px;
}
}@-webkit-keyframes menuOut {
	from {
	-webkit-transform:scale(1);
	transform:scale(1);
	border-radius:24px 24px 24px 4px;
}
to {
	-webkit-transform:scale(0.5);
	transform:scale(0.5);
	border-radius:50%;
}
}@keyframes menuOut {
	from {
	-webkit-transform:scale(1);
	transform:scale(1);
	border-radius:24px 24px 24px 4px;
}
to {
	-webkit-transform:scale(0.5);
	transform:scale(0.5);
	border-radius:50%;
}
}svg {
	width:26px;
	height:26px;
	fill:white;
	margin-right:10px;
}
.menu-btn-container {
	position:relative;
}
.menu-btn-pulse {
	position:absolute;
	left:50%;
	top:50%;
	-webkit-transform:translate(-50%,-50%) scale(0);
	transform:translate(-50%,-50%) scale(0);
	z-index:-1;
	width:80px;
	height:80px;
	border-radius:50%;
	border:1px solid rgba(248,41,171,0.28);
	-webkit-filter:blur(3px);
	filter:blur(3px);
}
.menu-btn-particle {
	width:6px;
	height:6px;
	position:absolute;
	display:inline-block;
	border-radius:50%;
	top:50%;
	left:50%;
	z-index:-1;
}

</style>
</head>

<body>
    <div class="container">
        <div class="menu">
            <h3>你的设置</h3>
            <ul>
                <li><a href="#"><svg><use xlink:href="#cog"></svg><span>编辑个人信息</span></a></li>
                <li><a href="#"><svg><use xlink:href="#picture"></svg><span>设置个人资料图片</span></a></li>
                <li><a href="#"><svg><use xlink:href="#lock"></svg><span>修改密码</span></a></li>
            </ul>
        </div>
        <div class="menu-btn-container"><button aria-pressed="false" aria-label="Open Menu" class="menu-btn"></button><span class="menu-btn-pulse"></span><span class="menu-btn-pulse"></span></div><svg><symbol id="cog" viewBox="0 0 1024 1024"><path d="M390.71 1008.755c-2.109 0-4.248-0.262-6.378-0.81-45.976-11.803-90.149-30.042-131.291-54.21-11.923-7.003-16.13-22.21-9.501-34.344            8.15-14.925 12.459-31.866 12.459-48.992 0-56.464-45.936-102.4-102.4-102.4-17.125 0-34.066 4.309-48.992 12.459-12.133 6.627-27.339            2.421-34.342-9.501-24.17-41.142-42.408-85.315-54.211-131.293-3.333-12.989 3.92-26.349 16.629-30.629 41.699-14.037 69.717-53.034            69.717-97.037s-28.018-83-69.718-97.040c-12.707-4.278-19.962-17.638-16.627-30.627 11.803-45.976 30.042-90.149 54.211-131.291 7.003-11.923 22.21-16.13            34.344-9.501 14.923 8.15 31.864 12.459 48.99 12.459 56.464 0 102.4-45.936 102.4-102.4 0-17.126-4.309-34.067-12.459-48.99-6.629-12.134-2.422-27.341            9.501-34.344 41.141-24.168 85.314-42.408 131.291-54.211 12.994-3.334 26.349 3.92 30.627 16.627 14.040 41.701 53.037 69.718 97.040 69.718s83-28.018            97.038-69.717c4.28-12.71 17.645-19.965 30.629-16.629 45.976 11.802 90.15 30.042 131.293 54.211 11.922 7.003 16.128 22.208 9.501 34.342-8.152            14.926-12.461 31.867-12.461 48.992 0 56.464 45.936 102.4 102.4 102.4 17.126 0 34.067-4.309 48.992-12.459 12.138-6.629 27.341-2.421 34.344 9.501            24.166 41.141 42.406 85.314 54.21 131.291 3.334 12.989-3.918 26.349-16.627 30.627-41.701 14.040-69.718 53.037-69.718 97.040s28.018            83 69.718 97.038c12.707 4.28 19.962 17.638 16.627 30.629-11.803 45.976-30.042 90.15-54.21 131.291-7.005 11.925-22.208 16.128-34.344            9.502-14.926-8.152-31.867-12.461-48.992-12.461-56.464 0-102.4 45.936-102.4 102.4 0 17.125 4.309 34.066 12.461 48.992 6.627 12.136 2.421            27.341-9.502 34.344-41.141 24.166-85.314 42.406-131.291 54.2.........完整代码请登录后点击上方下载按钮下载查看

网友评论0