原生js实现长猫拖动slider滑块效果代码
代码语言:html
所属分类:表单美化
代码描述:原生js实现长猫拖动slider滑块效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { font-size: calc(20px + (30 - 20) * (100vw - 320px) / (1280 - 320)); } body, input { font: 1em/1.5 Oswald, Impact, sans-serif; } body { background: #b9b548; color: #1a1a1a; display: flex; height: 100vh; } form { margin: auto; padding: 1.5em 0; } .longcat { margin-bottom: 0.5em; position: relative; width: 9em; height: 4em; } .longcat__torso, .longcat__torso:before, .longcat__torso:after, .longcat__input, .longcat__value, .longcat__sr { position: absolute; } .longcat__torso, .longcat__torso:before, .longcat__torso:after { content: ""; display: block; } .longcat__torso { border-radius: 0.5em 0 0.25em 0; top: 0.875em; height: 1em; } .longcat__torso, .longcat__torso:after { left: 0; } .longcat__torso:before { border-radius: 0.5em; top: 0; left: -1em; width: 1.5em; height: 0.25em; transform: rotate(-40deg); transform-origin: 1.375em 0.125em; transition: transform 0.25s ease-in-out; z-index: -1; } .longcat__torso:after { top: 0.75em; width: 1em; height: 0.875em; } .longcat__input { background-color: transparent; box-shadow: 1px 0 0 #404040; cursor: pointer; height: 2.5em; width: 100%; z-index: 1; -webkit-appearance: none; -moz-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; } .longcat__input:focus { outline: transparent; } .longcat__input::-moz-focus-outer { border: 0; } .longcat__input:active + .longcat__torso:before, .longcat__input:focus + .longcat__torso:before { transform: rotate(15deg); } .longcat__value { top: 2.5em; left: 0; text-align: center; width: 100%; } .longcat__sr { clip: rect(1px, 1px, 1px, 1px); overflow: hidden; width: 1px; height: 1px; } .longcat--light .longcat__torso { box-shadow: 0 -0.25em 0 #d9d9d9 inset; } .longcat--light .longcat__torso, .longcat--light .longcat__torso:before { background-color: white; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0