js+css实现滑块拖拽调整图片色相饱和度亮度对比度效果代码

代码语言:html

所属分类:拖放

代码描述:js+css实现滑块拖拽调整图片色相饱和度亮度对比度效果代码

代码标签: js css 滑块 拖拽 整图片 色相 饱和度 亮度 对比度

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

<style>
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300&display=swap');

:root {
    --range-width: 200px;
    --range-height: 16px;
    --thumb-width: 8px;
    --thumb-height: 24px;
}

* {
    box-sizing: border-box;
}

body {
    background: #A1FCE0;
    background: linear-gradient(-225deg, #87D9C1, #C1C18F);
    font-family: 'Oswald', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    position: relative;
}

.container {
    border: 20px solid #fff;
    border-radius: 8px;
    box-shadow: 4px 4px 20px 5px rgba(0,0,0,0.2);
}

.container::after {
    content: '';
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.5);
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.image-container {
    background: #fff;
}

img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    object-position: center center;
    border: 1px outset rgba(0,0,0,0.2);
    border-radius: 10px;
}

.sliders-container {
    padding-top: 10px;
    width: 100%;
    background: #fff;
}

.range-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

label {
    font-size: 1.2rem;
    position: relative;
    top: -3px;
}

input[type='range'] {
    width: var(--range-width);
    margin: 15px 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    position: relative;
}

input[type='range']:focus {
    outline: none;
}

/* Google Chrome & Safari */

input[type='range']::-webkit-slider-runnable-track {
    background: rgb(230, 230, 230);
    border-radius: 2px;
    width: 100%;
    height: var(--range-height);
    cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
    appearance: none;
    height: var(--thumb-height);
    width: var(--thumb-width);
    background: #575757;
    border-radius: 2px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
    top: -5px;
}

/* Firefox */

input[type='range']::-moz-range-track {
    background: rgb(230, 230, 230);
    border-radius: 2px;
    width: 100%;
    height: var(--range-height);
    cursor: pointer;
}

input[type='range']::-moz-range-thumb {
    appearance: none;
    height: var(--thumb-height);
    width: var(--thumb-width);
    background: #575757;
    border-radius: 2px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
    top: -5px;
}
</style>

  
  
</head>

<body>
  <div class="container".........完整代码请登录后点击上方下载按钮下载查看

网友评论0