css实现全屏缩放三维立体菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现全屏缩放三维立体菜单效果代码,点击右上角九宫格菜单显示立体菜单。

代码标签: css 全屏 缩放 三维 立体 菜单

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


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

<head>

  <meta charset="UTF-8">

  <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,700,900" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

  
  
  
<style>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Roboto', sans-serif;
    color: #323232;
    position: relative;
    perspective: 2000px;
    /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#45484d+0,000000+100;Black+3D+%231 */
    background: #45484d; /* Old browsers */
    background: -moz-linear-gradient(45deg,  #45484d 0%, #000000 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(45deg,  #45484d 0%,#000000 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(45deg,  #45484d 0%,#000000 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
.bodyWrapper {
    background-color: #E9EBEE;
    transition: transform .3s ease-in-out;
    transform-origin: 100% 0 0;
    position: relative;
}
.bodyWrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0);
    z-index: -1;
    transition: background-color .3s;
}
header {
    max-height: 350px;
    overflow: hidden;
}
header img {
    width: 100%;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.content {
    max-width: 650px;
    margin: 0 auto;
}
.content h1 {
    margin: 40px 0 20px 0;
    font-size: 2.3em;
}
.content p {
    margin: 20px 0;
    line-height: 1.4;
}
footer {
    background-color: #323232;
    text-align: center;
    height: 100px;
    padding: 30px;
    margin-top: 100px;
}
footer a {
    color: #efefef;
}

/* ######################### */

div.logo {
    width: 50px;
    height: 50px;
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    z-index: 999;
}
rect[class^="cls-"] {
     fill: #efefef;
 }
div.logo:hover rect {
    animation: logoHover .4s ease-out;
}
.cls-4, .cls-8 {
    animation-delay: .1s !important;
}
.cls-1, .cls-5, .cls-9 {
    animation-delay: .2s !important;
}
.cls-2, .cls-6 {
    animation-delay: .3s !important;
}
.cls-3 {
    animation-delay: .4s !important;
}
@keyframes logoHover {
    0% {fill: #efefef;}
    50% {fill: #FF5722;}
    100% {fill: #efefef;}
}

/* ######################### */

body.menuToggle .bodyWrapper {
    transform: scale(.8) rotateY(-40deg); /*  scale(.9) */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-box-shadow: 0 0 10px 0 rgba(0,0,0,0.75);
    -moz-box-shadow: 0 0 10px 0 rgba(0,0,0,0.75);
    box-shadow: 0 0 10px 0 rgba(0,0,0,0.75);
}
body.menuToggle .bodyWrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}
/*
.menuWrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #595a5b;
    transition: transform .3s;
    transform-origin: 0 100% 0;
    z-index: -1;
}
body.menuToggle .menuWrapper {
    transform: scale(.9) rotateY(40deg);
}
*/
.menuWrapper {
    position: absolute;
    top: 19%;
    left: 20%;
    transition: transform .5s ease-out .3s, opacity .5s ease-out .3s;
    z-index: -1;
    opacity: 0;
    transform:translateX(20px);
}
body.menuToggle .menuWrapper {
    opacity: 1;
    transform: translateX(0);
}
/*
.bothWrapper {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
}
.menuWrapper {
    background-color: #595a5b;
    transition: transform .3s;
    transform-origin: 100% 0 0;
    transform: scale(.9) rotateY(40deg);
}
*/

.menu, .menu a {
    color: #efefef;
    text-decoration: none;
}

.menu h3 {
    letter-spacing: 15px;
    border-bottom: 1px solid #efefef;
    font-size: 3em;
}
.menu ul {
    list-style-type: none;
}
.menu ul li {
    display: flex;
    font-size: 2em;
    align-items: center;
}
.menu ul li a {
    padding: 15px 0;
    margin: 5px 0;
    font-weight: 100;
    transition: color .3s;
 }
.menu ul li a:hover {
    color:#FF5722;
}
</style>


</head>


  <body class="menuToggle">
<div class="logo">
    <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 122 122">
        <rect class="cls-1" width="35" height="35"/>
        <rect class="cls-2" x="43.5" width="35" height="35"/>
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0