css水滴形导航效果
代码语言:html
所属分类:菜单导航
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Alata&display=swap"); * { box-sizing: border-box; } :root { --speed: 0.85; --primary: #fff; --size: 30; --ease: cubic-bezier(0.175, 0.885, 0.32, 1.275); } body { background: #fafafa; font-family: 'Alata', sans-serif; min-height: 100vh; overflow-x: hidden; padding: 0; } main { height: 100vh; overflow-y: scroll; scroll-behavior: smooth; -ms-scroll-snap-type: y mandatory; scroll-snap-type: y mandatory; } section { -webkit-box-align: center; align-items: center; display: -webkit-box; display: flex; font-size: 3rem; height: 100vh; -webkit-box-pack: center; justify-content: center; scroll-snap-align: center; width: 100vw; } .menu { position: fixed; } .menu__toggle { opacity: 0; position: absolute; } .menu__toggle:checked ~ .menu__content .menu__item { --active-x: var(--x); --active-y: var(--y); --scale: 1; } .menu__toggle:checked ~ .menu__toggle-label:not(.menu__toggle-label--closer) { --clip: circle(1000% at 0% 0%); height: 100vh; width: 100vw; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); } .menu__toggle:checked ~ .menu__toggle-label .menu__icon:nth-of-type(1) { --scale: 0; } .menu__toggle:checked ~ .menu__toggle-label .menu__icon:nth-of-type(2) { --scale: 1; } .menu__toggle-label { cursor: pointer; height: calc(var(--size, 20) * 0.5vmin); width: calc(var(--size, 20) * 0.5vmin); display: block; --clip: circle(100% at 0% 0%); -webkit-clip-path: var(--clip); clip-path: var(--clip); position: absolute; top: 0; left: 0; transition: backdrop-filter calc(var(--speed, 1) * 1s) var(--ease), clip-path 0s, -webkit-clip-path 0s; } .menu__toggle-label--closer { z-index: 3; --scale: 0; } .menu__icon { --scale: 1; height: calc(var(--size, 20) * 0.25vmin); width: calc(var(--size, 20) * 0.25vmin); position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-70%, -70%) scale(var(--scale, 1)); transform: translate(-70%, -70%) scale(var(--scale, 1)); fill: var(--primary); -webkit-transition: all calc(var(--speed, 1) * 1s) var(--ease); transition: all calc(var(--speed, 1) * 1s) var(--ease); } .menu__icon:nth-of-type(2) { --scale: 0; } .menu__content { background: hsl(var(--hue, 0), 50%, 50%); margin: 0; display: block; list-style-type: none; z-index: -1; -webkit-filter: url("#goo"); filter: url("#goo"); position: absolute; top: 0; height: 0; width: 0; left: 0; z-index: 2; } .menu__content:after { background: hsl(var(--hue, 0), 50%, 50%); content: ''; border-radius: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; height: calc(var(--size, 20) * 1vmin); width: calc(var(--size, 20) * 1vmin); top: 0; left: 0; } .menu__item { background: hsl(var(--hue, 0), 50%, 50%); border-radius: 50%; cursor: pointer; display: -webkit-box; display: flex; list-style-type: none; font-size: 1rem; height: calc(var(--size, 20) * 1vmin); left: calc(var(--active-x, 0) * 1vw); overflow: hidden; place-items: center; position: absolute; text-align: center; top: calc(var(--active-y, 0) * 1vh); -webkit-transform: transl.........完整代码请登录后点击上方下载按钮下载查看
网友评论0