Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
105 lines (101 sloc) 2.52 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>transition</title>
<style>
.box {
margin: 150px;
}
.item {
height: 100px;
width: 100px;
background: gold;
box-sizing: border-box;
padding: 30px 0;
text-align: center;
}
.one {
font-size: 13px;
transition: opacity .5s linear, background-color .5s linear, font-size .5s linear;
}
.one:hover {
opacity: 0.8;
font-size: 18px;
background: green;
}
.two {
transition: all .5s linear;
}
.two:hover {
width: 200px;
height: 200px;
}
.three {
transition: all .5s linear;
}
.three:hover {
transform: translateX(50px) rotate(360deg);
}
.stage {
perspective: 300px;
width: 100px;
height: 100px;
}
.container {
transform-style: preserve-3d;
height: 100%;
width: 100%;
}
.four {
transition: all .5s linear;
}
.four:hover {
transform: rotate3d(.1, .1, .1, 360deg);
}
.five {
transition: all .5s linear;
}
.five.active {
transform: translateX(100px) translateY(100px);
opacity: 0.2;
}
</style>
</head>
<body>
<div class="box">
<div class="item one">one</div>
</div>
<div class="box">
<div class="item two">two</div>
</div>
<div class="box">
<div class="item three">three</div>
</div>
<div class="box">
<div class="stage">
<div class="container">
<div class="item four">four</div>
</div>
</div>
</div>
<div class="box">
<div class="item five">five</div>
</div>
<script>
const el = document.querySelector('.five');
let flag = true;
el.onclick = (e) => {
if (flag) {
e.target.className = 'item five' + ' active';
flag = false;
} else {
e.target.className = 'item five';
flag = true;
}
}
</script>
</body>
</html>
You can’t perform that action at this time.