CustomEase+gsap实现炫酷弹出式导航菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:CustomEase+gsap实现炫酷弹出式导航菜单效果代码

代码标签: CustomEase gsap 炫酷 弹出式 导航 菜单

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

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

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

  
<style>

@font-face {
  font-family: 'PP Neue Corp Tight';
  src: url('https://cdn.prod.website-files.com/673af51dea86ab95d124c3ee/673b0f5784f7060c0ac05534_PPNeueCorp-TightUltrabold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.osmo-ui {
  z-index: 0;
  pointer-events: none;
  flex-flow: column;
  justify-content: space-between;
  align-items: stretch;
}

.nav-row {
  justify-content: space-between;
  align-items: center;
  width: 100%;
  display: flex;
}

.nav-logo-row {
  pointer-events: auto;
  justify-content: space-between;
  align-items: center;
  width: 13em;
  display: flex;
}

.nav-logo__wordmark {
  width: 4em;
}

.nav-logo__icon {
  width: 1.5em;
  height: 1.5em;
}

.container {
  z-index: 1;
  max-width: var(--size-container);
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

.container.is--full {
  max-width: 100%;
}

.nav-row__right {
  grid-column-gap: .625rem;
  grid-row-gap: .625rem;
  pointer-events: auto;
  justify-content: flex-end;
  align-items: center;
  display: flex;
}

.header {
  z-index: 110;
  padding-top: var(--gap);
  position: fixed;
  inset: 0% 0% auto;
}

.website-link {
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}

.website-link.is--alt {
  grid-column-gap: .25em;
  grid-row-gap: .25em;
  justify-content: flex-start;
  align-items: center;
  height: 1.5em;
  display: flex;
}

.inline-link__p {
  margin-bottom: 0;
}

.body {
  background-color: var(--color-neutral-300);
  color: var(--color-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 500;
  line-height: 1;
}

p{
  margin: 0px
}

.cloneable {
  padding: var(--section-padding) var(--container-padding);
  justify-content: center;
  align-items: center;
  min-height: 100svh;
  display: flex;
  position: relative;
  --menu-padding: 2em;
}

.nav {
  z-index: 100;
  width: 100%;
  height: 100vh;
  margin-left: auto;
  margin-right: auto;
  display: block;
  position: fixed;
  inset: 0%;
}

.overlay {
  z-index: 0;
  cursor: pointer;
  background-color: #13131366;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0%;
}

.menu {
  padding-bottom: var(--menu-padding);
  grid-column-gap: 5em;
  grid-row-gap: 5em;
  padding-top: calc(3 * var(--menu-padding));
  flex-flow: column;
  justify-content: space-between;
  align-items: flex-start;
  width: 35em;
  height: 100%;
  margin-left: auto;
  position: relative;
  overflow: auto;
}

.menu-bg {
  z-index: 0;
  position: absolute;
  inset: 0%;
}

.menu-inner {
  z-index: 1;
  grid-column-gap: 5em;
  grid-row-gap: 5em;
  flex-flow: column;
  justify-content: space-between;
  align-items: flex-start;
  height: 100%;
  display: flex;
  position: relative;
  overflow: auto;
}

.bg-panel {
  z-index: 0;
  background-color: var(--color-neutral-300);
  border-top-left-radius: 1.25em;
  border-bottom-left-radius: 1.25em;
  position: absolute;
  inset: 0%;
}

.bg-panel.first {
  background-color: var(--color-primary);
}

.bg-panel.second {
  background-color: var(--color-neutral-100);
}

.menu-list {
  flex-flow: column;
  width: 100%;
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
}

.menu-list-item {
  position: relative;
  overflow: hidden;
}

.menu-link-heading{ text-shadow: 0px 1em 0px var(--color-neutral-200); }

.menu-link {
  padding-top: .75em;
  padding-bottom: .75em;
  padding-left: var(--menu-padding);
  grid-column-gap: .75em;
  grid-row-gap: .75em;
  width: 100%;
  text-decoration: none;
  display: flex;
}

.menu-link-heading {
  z-index: 1;
  text-transform: uppercase;
  font-family: PP Neue Corp Tight, Arial, sans-serif;
  font-size: 5.625em;
  font-weight: 700;
  line-height: .75;
  transition: transform .55s cubic-bezier(.65, .05, 0, 1);
  position: relative;
}

.eyebrow {
  z-index: 1;
  color: var(--color-primary);
  text-transform: uppercase;
  font-family: RM Mono, Arial, sans-serif;
  font-weight: 400;
  position: relative;
}

.menu-link-bg {
  z-index: 0;
  background-color: var(--color-neutral-800);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.65, .05, 0, 1);
  position: absolute;
  inset: 0%;
  transform: scale3d(1, 0, 1);
}

.menu-details {
  padding-left: var(--menu-padding);
  grid-column-gap: 1.25em;
  grid-row-gap: 1.25em;
  flex-flow: column;
  justify-content: flex-start;
  align-items: flex-start;
  display: flex;
}

.p-small {
  font-size: .875em;
  font-family: Arial, Helvetica;
}

.socials-row {
  grid-column-gap: 1.5em;
  grid-row-gap: 1.5em;
  flex-flow: row;
  display: flex;
}

.p-large {
  font-size: 1.125em;
  font-family: Arial, Helvetica;
}

.text-link {
  text-decoration: none;
  position: relative;
}

.menu-button {
  grid-column-gap: .625em;
  grid-row-gap: .625em;
  background-color: #0000;
  justify-content: flex-end;
  align-items: center;
  margin: -1em;
  padding: 1em;
  display: flex;
  border: none;
}

.menu-button-icon {
  width: 1em;
  height: 1em;
}

.menu-button-text {
  flex-flow: column;
  justify-content: flex-start;
  align-items: flex-end;
  height: 1.125em;
  display: flex;
  overflow: hidden;
}

.icon-wrap {
  transition: transform .4s cubic-bezier(.65, .05, 0, 1);
}

@media (hover:hover){
  
   /* Menu toggle button*/
  .menu-button:hover .icon-wrap{transform: rotate(90deg); }

  /* Menu Large Links */
  .menu-link:hover .menu-link-heading{ transform: translate(0px, -1em); transition-delay: 0.1s; }
  .menu-link:hover .menu-link-bg{ transform: scale(1,1) }

  /* Menu Smaller Links */
  .text-link::after{
    content: '';
    position:absolute;
    left: 0;
    bottom: 0;
    width:100%;
    height:1px;
    background: var(--color-primary);
    transform-origin: right center;
    transform: scale(0,1);
    transition: transform 0.4s var(--cubic-default)
  }

  .text-link:hover::after{
    transform-origin: left center;
    transform: scale(1,1);	
  }
  
}

.osmo-icon-svg {
  width: 8em;
}

@media screen and (max-width: 767px) {
  .cloneable{
  	--menu-padding: 1em;
  }
  
  .nav-logo-row {
    grid-column-gap: 2.5em;
    grid-row-gap: 2.5em;
    width: auto;
  }

  .nav-row__right {
    grid-column-gap: 0rem;
    grid-row-gap: 0rem;
  }

  .cloneable-title {
    pointer-events: none;
    width: calc(100% - 5.25em);
    padding-left: 1em;
    position: absolute;
    overflow: hidden;
  }

  .cloneable-title__nr, .cloneable-title__h1 {
    font-size: .875em;
  }

  .clone-in-webflow {
    justify-content: flex-end;
    width: 100%;
    margin-right: 0;
    padding-left: .75em;
  }

  .clone-in-webflow__p {
    display: none;
  }

  .cloneable-title__gradient, .osmo-ui__bg {
    display: block;
  }

  .menu {
    padding-top: calc(6 * var(--menu-padding));
    width: 100%;
  }

  .bg-panel {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .menu-list-item {
    height: 4.5em;
  }

  .menu-link-heading {
    font-size: 4em;
  }

  .socials-row {
    grid-column-gap: 1em;
    grid-row-gap: 1em;
  }

  .p-large.text-link {
    font-size: 1em;
  }
}

@media screen and (max-width: 479px) {
  .menu {
    padding-top: calc(7 * var(--menu-padding));
    padding-bottom: calc(2 * var(--menu-padding));
  }
}

 
/* ------------------------- Variables ------------------------------------------- */

:root {
  --color-light: var(--color-neutral-200);
  --color-dark: var(--color-neutral-800);
  --color-primary: #ff4c24;
  --color-neutral-100: #ffffff;
  --color-neutral-200: #efeeec;
  --color-neutral-300: #e3e1de;
  --color-neutral-400: #cbc8c5;
  --color-neutral-500: #818180;
  --color-neutral-600: #2c2c2c;
  --color-neutral-700: #1f1f1f;
  --color-neutral-800: #131313;
  --color-neutral-900: #000000;
  --color-white: var(--color-neutral-100);
  --color-black: var(--color-neutral-900);
  --color-error: var(--color-primary);
  --color-success: #0ba954; 
  --cubic-default: cubic-bezier(0.65, 0.05, 0, 1);
  --duration-default: 0.735s;
  --animation-default: var(--duration-default) var(--cubic-default);
  --gap: 2em;
  --section-padding: calc(3.5em + (var(--gap) * 2));
  --container-padding: 2em;
  --header-height: calc(1.5em + (var(--gap) * 2));
  --footer-height: calc(2.785em + (var(--gap) * 2));
}

/* Tablet */
@media screen and (max-width: 991px) {
  :root {
    --container-padding: 1.5em;
  }
}

/* Mobile Landscape */
@media screen and (max-width: 767px) {
  :root {
    --container-padding: 1em;
  }
}

/* Mobile Portrait */
@media screen and (max-width: 479px) {
  :root {}
}

/* ------------------------- Scaling System by Osmo [https://osmo.supply/] -------------------------  */

/* Desktop */
:root {
  --size-unit: 16; /* body font-size in design - no px */
  --size-container-ideal: 1440; /* screen-size in design - no px */
  --size-container-min: 992px;
  --size-container-max: 1920px;
  --size-container: clamp(var(--size-container-min), 100vw, var(--size-container-max));
  --size-font: calc(var(--size-container) / (var(--size-container-ideal) / var(--size-unit)));
}

/* Tablet */
@media screen and (max-width: 991px) {
  :root {
    --size-container-ideal: 834; /* screen-size in design - no px */
    --size-container-min: 768px;
    --size-container-max: 991px;
  }
}

/* Mobile Landscape */
@media screen and (max-width: 767px) {
  :root {
    --size-container-ideal: 390; /* screen-size in design - no px */
    --size-container-min: 480px;
    --size-container-max: 767px;
  }
}

/* Mobile Por.........完整代码请登录后点击上方下载按钮下载查看

网友评论0