react+gsap实现导航条菜单悬浮滑动动画效果代码
代码语言:html
所属分类:菜单导航
代码描述:react+gsap实现导航条菜单悬浮滑动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; padding: 0; font-family: Roboto, sans-serif; } .menu { display: flex; justify-content: space-between; position: relative; z-index: 1; padding: 20px; max-width: 800px; margin: 20px auto; border-bottom: 1px solid #eee; } @media (max-width: 650px) { .menu { flex-direction: column; align-items: center; } } .menu .item { padding: 18px 28px; cursor: pointer; transition: color 0.3s ease-out; text-decoration: none; color: #111; letter-spacing: 0.05em; text-transform: uppercase; font-size: 12px; margin: 5px 0; } .menu .item.active { color: #fff; } .menu .indicator { top: 0; left: 0; position: absolute; z-index: -1; border-radius: 30px; } </style> </head> <body > <div id="root"></div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.17.1.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.17.1.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script> <script > const { useRef, useState, useEffect, createRef } = React; /*-------------------- Items --------------------*/ const items = [ { name: "Freelance", color: "#f44336", href: "#" }, { name: "Design", color: "#e91e63", href: "#" }, { name: "Director", color: "#9c27b0", href: "#" }, { name: "Experience", color: "#673ab7", href: "#" }, { name: "Interface", color: "#3f51b5", href: "#" }]; /*------------------.........完整代码请登录后点击上方下载按钮下载查看
网友评论0