css实现图片filter拖动对比效果代码
代码语言:html
所属分类:其他
代码描述:css实现图片filter拖动对比效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --tra: all 0.5s ease 0s; } body { margin: 0; padding: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; font-family: Arial, Helvetica, serif; background: radial-gradient(circle at 50% 0%, #000, #333); } body:before { content: "IMAGES FROM UNSPLASH.COM"; position: absolute; color: #fff0; left: 50%; transform: translateX(-50%); text-shadow: 0 1px 1px #333d, 0 -1px 1px #ffffff82; font-family: Arial, serif; font-size: 1.3vmin; margin-top: -86.5vmin; } body * { box-sizing: border-box; } .comparsion { width: 40vmin; height: 30vmin; position: relative; transform: scale(2.25); box-shadow: 0 0 0 1vmin #fff; } .comparsion > div { background: url(//repo.bfw.wiki/bfwrepo/image/646ee114955eb.png) no-repeat 0 0; background-size: cover; width: 100%; height: 100%; position: absolute; } .filtered { filter: sepia(0.9); } .comparsion > .original { width: calc(50% + 2px); resize: horizontal; overflow: hidden; max-width: calc(40vmin - 1.35vmin); border-right: 0.325vmin solid #fff8; } div::-webkit-resizer { background: linear-gradient(135deg, #fff0 0 1.5vmin, #fff 0 1.7vmin, #fff0 0 1.9vmin, #fff 0 2.1vmin, #fff0 0 2.3vmin, #fff 0 2.5vmin, #fff0 0 2.7vmin, #fff 0 100%); } label, a { position: absolute; margin-top: 88vmin; background: red; width: 5vmin; height: 5vmin; cursor: pointer; borde.........完整代码请登录后点击上方下载按钮下载查看
网友评论0