js+css实现选择用户图像左右滑动效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现选择用户图像左右滑动效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body, * { margin: 0; padding: 0; color: var(--white); font-family: 'VisbyCF-Bold', sans-serif; } /* @font-face { font-family: 'VisbyCF'; font-weight: 700; font-style: normal; src: url('/assets/fonts/VisbyCF-Bold.otf') format('truetype'); }*/ :root { --white: #FFFFFF; --green: #2EA9A5; --black: #0D111F; } .choose-avatar { position: fixed; background: var(--black); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; } .title { font-weight: 700; font-size: 24px; } .avatar-item { width: 145px; height: 145px; background-size: cover; border-radius: 55px; transition: transform 500ms; transition-timing-function: cubic-bezier(0.22, 0.11, 0.67, 0.55); } .avatars-container { display: flex; width: 500px; height: 300px; overflow: hidden; justify-content: center; align-items: center; font-family: monospace; position: relative; gap: 50px; } .avatars-container::before { content: '<'; position: absolute; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 35px; z-index: 1; left: 0; top: 0; display: flex; box-shadow: 0px 0px 50px 60px var(--black); background: var(--black); } .avatars-container::after { content: '>'; position: absolute; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 35px; right: 0; top: 0; display: flex; box-shadow: 0px 0px 50px 60px var(--black); background: var(--black); } .avatars { position: relative; display: flex; gap: 50px; transition: transform 500ms; } #text-avatar { display: none; } .button-simple { padding: 20px 70px; border-radius: 16px; font-size: 20px; background-color: var(--green); border: none; font-weight: 700; transition: .3s; } .button-simple:hover { cursor: pointer; opacity: .8; } .left { position: absolute; left: 0; width: 35px; height: 50px; z-index: 2; cursor: pointer; } .right { position: absolute; right: 0; width: 35px; height: 50px; z-index: 2; cursor: pointer; } .current { transform: scale(1.3); } .current:hover #text-avatar { display: block; } .current:hover { cursor: pointer; background-blend-mode: overlay; background-color: #0d111f89; place-items: center; display: grid; } </style> </head> <body> <!-- partial:index.partial.html --> <div class="choose-avatar"> <span class="title">Choose your avatar</span> <div class="avatars-container"> <span class="left"></span> <div class="avatars"> <div class="avatar-item" style="background-image: url('//repo.bfw.wiki/bfwrepo/icon/65a9ef733aae6.png');"> <span id="text-avatar">Choose</span> </div> <div class="avatar-item" style="background-image: url('//repo.bfw.wiki/bfwrepo/icon/65a9ef789a542.png');"> <span id="text-avatar">Choose</span> </div> <div class="avatar-item" style="background-image: url(.........完整代码请登录后点击上方下载按钮下载查看
网友评论0