-
Notifications
You must be signed in to change notification settings - Fork 1
/
image_moving.html
66 lines (62 loc) · 1.6 KB
/
image_moving.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<title>Image Rotation</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9"
crossorigin="anonymous"
/>
<style>
img {
transition: 0.5s;
max-height: 600px;
}
.rotate {
transform: rotate(15deg);
position: absolute;
top: auto;
left: auto;
}
.rotate-negative {
transform: rotate(-5deg);
position: absolute;
top: auto;
left: auto;
}
.top-image:hover {
transform: rotate(0deg);
transition: 0.5s;
max-height: 620px;
}
#container {
margin: 0 auto;
height: 500px;
width: 30%;
background-color: black;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div id="container">
<img
src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcToJI-yx2dCcsVf3fYDDRF908iRO_dlTsL9H32iWWIkT_1dYuimsdBUZKTIZgYC61z6Vik&usqp=CAU"
id="pic"
/>
</div>
<script>
const image = document.getElementById('pic');
image.classList.add('rotate');
const clone = image.cloneNode(true);
clone.classList.add('rotate-negative');
clone.classList.add('top-image');
clone.classList.add('shadow-lg');
document.getElementById('container').appendChild(clone);
</script>
</body>
</html>