css实现冷热切换滑块滑动效果代码

代码语言:html

所属分类:拖放

代码描述:css实现冷热切换滑块滑动效果代码

代码标签: css 冷热 切换 滑块 滑动

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

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

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

 
 
 
<style>
@property --x { syntax: "
<number>"; inherits: false; initial-value: 0 }
@property --y { syntax: "
<number>"; inherits: false; initial-value: 0 }

.hotcold{
  width: 80vmin;
  aspect-ratio: 3;
  position: relative;
  > i {
    position: absolute;
    --w: calc(100% / 21);
    --h: calc(100% / 7);
    width: var(--w);
    height: var(--h);

    --yd: calc(((var(--ty) - var(--y)) * var(--h)) / 100 * var(--val, 0));
    --xd: calc(((var(--tx) - var(--x)) * var(--w)) / 100 * var(--val, 0));

    top: calc(var(--y) * var(--h) + var(--yd));
    left: calc(var(--x) * var(--w) + var(--xd));
    background-color: var(--heat-color);
               
    &:nth-child(1)  { --y: 0; --x:  0; --ty: 0; --tx:  0 }
    &:nth-child(2)  { --y: 0; --x:  1; --ty: 0; --tx:  0 }
    &:nth-child(3)  { --y: 0; --x:  2; --ty: 3; --tx:  3 }
    &:nth-child(4)  { --y: 0; --x:  6; --ty: 0; --tx:  4 }
    &:nth-child(5)  { --y: 0; --x:  7; --ty: 0; --tx:  9 }
    &:nth-child(6)  { --y: 0; --x:  8; --ty: 0; --tx:  8 }
    &:nth-child(7)  { --y: 0; --x: 12; -.........完整代码请登录后点击上方下载按钮下载查看

网友评论0