File tree Expand file tree Collapse file tree 6 files changed +149
-0
lines changed
81. Animated Images Website Expand file tree Collapse file tree 6 files changed +149
-0
lines changed Original file line number Diff line number Diff line change
1
+ let btns = document.querySelectorAll(".btn");
2
+ let banner = document.getElementById("banner");
3
+
4
+ btns.forEach((btn, index) => {
5
+ btn.addEventListener("click", () => {
6
+ banner.src = `images/${index}.jpg`;
7
+ animation();
8
+ btn.classList.add("active");
9
+ });
10
+ });
11
+
12
+ function animation() {
13
+ banner.classList.add("zoom");
14
+
15
+ setTimeout(() => {
16
+ banner.classList.remove("zoom");
17
+ }, 1000);
18
+
19
+ for (b of btns) {
20
+ b.classList.remove("active");
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+
2
+
3
+
4
+
5
+
6
+
Animated Images
7
+
8
+
9
+
10
+
11
+
12
+
13
+
Explore Best Properties
14
+
15
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur
16
+ saepe voluptatem iusto cupiditate iure qui quas natus facere
17
+ voluptates. Recusandae dicta quae doloribus repellat. A
18
+ reprehenderit mollitia incidunt vitae nihil.
19
+
20
+ More Properties
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
Original file line number Diff line number Diff line change
1
+ * {
2
+ padding: 0;
3
+ margin: 0;
4
+ box-sizing: border-box;
5
+ font-family: sans-serif;
6
+ }
7
+
8
+ button {
9
+ margin-right: -20px;
10
+ padding: 15px 40px;
11
+ border: 0;
12
+ outline: none;
13
+ border-radius: 25px;
14
+ background: #333;
15
+ color: #fff;
16
+ font-size: 14px;
17
+ cursor: pointer;
18
+ box-shadow: 0 10px 10px rgba(0, 0, 0, 0.2);
19
+ }
20
+
21
+ .row {
22
+ width: 100%;
23
+ display: flex;
24
+ justify-content: space-between;
25
+ background: #fff;
26
+ border-radius: 15px;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .col-1 .col2 {
31
+ overflow: hidden;
32
+ }
33
+
34
+ .col-1 {
35
+ display: flex;
36
+ flex-direction: column;
37
+ justify-content: space-around;
38
+ }
39
+
40
+ .col-2 img {
41
+ width: 35rem;
42
+ height: 100vh;
43
+ margin-bottom: -5px;
44
+ }
45
+
46
+ .col-1 {
47
+ padding: 8% 5%;
48
+ position: relative;
49
+ }
50
+
51
+ .col-1 p {
52
+ color: #777;
53
+ line-height: 22px;
54
+ margin: 15px 0 30px;
55
+ max-width: 500px;
56
+ }
57
+
58
+ ul {
59
+ position: absolute;
60
+ bottom: 30px;
61
+ }
62
+
63
+ ul li {
64
+ list-style: none;
65
+ width: 15px;
66
+ height: 15px;
67
+ display: inline-block;
68
+ background: #bfbfbf;
69
+ border-radius: 50%;
70
+ margin-right: 15px;
71
+ cursor: pointer;
72
+ }
73
+
74
+ ul .active {
75
+ background: #333;
76
+ }
77
+
78
+ /* JavaScript */
79
+ .zoom {
80
+ animation: zoom 1s;
81
+ }
82
+
83
+ @keyframes zoom {
84
+ 0% {
85
+ transform: scale(1.2);
86
+ }
87
+ 100% {
88
+ transform: scale(1);
89
+ }
90
+ }
You can’t perform that action at this time.
0 commit comments