react实现跷跷板开关效果代码

代码语言:html

所属分类:其他

代码描述:react实现跷跷板开关效果代码

代码标签: react 跷跷板 开关

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

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

<head>
  <meta charset="UTF-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  
  
<style>
@import url("https://fonts.googleapis.com/css?family=Merriweather:700|Roboto");
html {
  font-family: "Roboto", sans-serif;
  background-color: #ded6ec;
  min-height: 100dvh;
}

.header {
  color: #583740;
  max-width: min(80vw, 700px);
  text-align: center;
}

.appWrapper {
  margin-bottom: 5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.toggleContainer {
  --width: 100px;
  --halfWidth: calc(var(--width) / 2);
  --height: calc(2 * sin(var(--pivotAngle)) * var(--halfWidth));
  --pivotAngle: 25deg;
  --negPivotAngle: calc(var(--pivotAngle) * -1);
  --seeSawCol: black;
  --animSpeed: 0.5s;
  display: block;
  cursor: pointer;
  position: relative;
  width: var(--width);
  height: var(--height);
  margin: 4rem 0;
}
.toggleContainer .pivot {
  --halfHeight: calc(var(--height) / 2);
  --quartHeight: calc(var(--height) / 4);
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translate(-50%, 20%);
  width: 0;
  height: 0;
  border-left: var(--quartHeight) solid tr.........完整代码请登录后点击上方下载按钮下载查看

网友评论0