vue实现图片上下左右拖拽对比代码
代码语言:html
所属分类:拖放
代码描述:vue实现图片上下左右拖拽对比代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue3.0.5.js"></script> <style type="text/css">/* Variables */ :root { --background-primary: #222831; --background-secondary: #31363f; --color-text: #eee; } /* General styles */ body { background-color: var(--background-primary); font-family: Arial; padding: 1rem; } /* Components */ #app { align-items: center; color: var(--color-text); display: flex; flex-direction: column; width: 100%; } #app fieldset { margin-bottom: 1rem; } #app label { display: block; } #image-compare { box-shadow: 0 0 2rem rgba(0, 0, 0, 0.4); height: 600px; position: relative; width: min(900px, 100%); z-index: 1; } #image-compare img { height: 100%; object-fit: cover; left: 0; position: absolute; top: 0; transition: clip-path 0.05s ease-in; width: 100%; z-index: -1; } #image-compare input[type=range] { appearance: none; background: transparent; border: none; height: 100%; width: 100%; z-index: 2; } #image-compare input[type=range].vertical { direction: ltr; vertical-align: middle; writing-mode: vertical-lr; } #image-compare input[type=range]::-webkit-slider-thumb { appearance: none; aspect-ratio: 1; background-color: #fff; border-radius: 50%; box-shadow: 0 0 8px rgba(0, 0, 0, 0.8); cursor: pointer; width: 1.5rem; z-index: 3; }</style> </head> <body> <div id="app"> <main> <h1>ImageCompare (Vue)</h1> <fieldset> <legend>Orientation</legend> <label for="horizontal"> <input id="horizontal" name="orientation" type="radio" v-mode.........完整代码请登录后点击上方下载按钮下载查看
网友评论0