js实现立体前后照片对比拖拽效果代码
代码语言:html
所属分类:拖放
代码描述:js实现立体前后照片对比拖拽效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .compare { --mask-width: 50%; --handle-size: 32px; position: relative; border: 1px solid rgba(0, 0, 0, 0.05); } .compare__separator { position: absolute; top: 0; height: 100%; left: var(--mask-width); width: 2px; margin-left: -1px; background: black; z-index: 1; pointer-events: none; } .compare__image-one { width: 100%; display: block; } .compare__mask { position: absolute; top: 0; left: 0; height: 100%; z-index: 1; background: white; overflow: hidden; width: var(--mask-width); } .compare__image-two { height: 100%; width: auto; } .compare__input { appearance: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; position: absolute; top: 0; left: calc(var(--handle-size) / -2); width: calc(100% + var(--handle-size)); height: 100%; opacity: 0; z-index: 2; cursor: col-resize; background-color: transparent; } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0