Skip to content

Commit 7c10cd9

Browse files
committed
chore: add scroll effect for gallery
1 parent e9873a1 commit 7c10cd9

File tree

2 files changed

+76
-14
lines changed

2 files changed

+76
-14
lines changed

index.html

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,47 @@ <h2>Contact Me</h2>
108108

109109
<section>
110110
<h2>Gallery</h2>
111-
<div class="gallery">
112-
<div class="gallery-item">
113-
<img src="./profile.jpg" height="200px" width="300px" />
111+
<div class="gallery-wrapper">
112+
<button class="scroll-button left"><</button>
113+
<div class="gallery">
114+
<div class="gallery-item">
115+
<img src="./profile.jpg" height="200px" width="300px" />
116+
</div>
117+
<div class="gallery-item">
118+
<img src="./gym.jpg" height="200px" width="300px" />
119+
</div>
120+
<div class="gallery-item">
121+
<img src="./mindililwo.jpg" height="200px" width="300px" />
122+
</div>
123+
<div class="gallery-item">
124+
<img src="./serious.jpg" height="200px" width="300px" />
125+
</div>
126+
<div class="gallery-item">
127+
<img src="./mindililwo-2.jpg" height="200px" width="300px" />
128+
</div>
129+
<div class="gallery-item">
130+
<img src="./mimi.jpg" height="200px" width="300px" />
131+
</div>
132+
<div class="gallery-item">
133+
<img src="./momi.jpg" height="200px" width="300px" />
134+
</div>
135+
<div class="gallery-item">
136+
<img src="./rasta.jpg" height="200px" width="300px" />
137+
</div>
138+
<div class="gallery-item">
139+
<img src="./chief.jpg" height="200px" width="300px" />
140+
</div>
141+
<div class="gallery-item">
142+
<img src="./father.jpg" height="200px" width="300px" />
143+
</div>
144+
<div class="gallery-item">
145+
<img src="./wasee.jpg" height="200px" width="300px" />
146+
</div>
147+
<div class="gallery-item">
148+
<img src="./suti.jpg" height="200px" width="300px" />
149+
</div>
114150
</div>
115-
<div class="gallery-item">
116-
<img src="./gym.jpg" height="200px" width="300px" />
117-
</div>
118-
<div class="gallery-item">
119-
<img src="./mindililwo.jpg" height="200px" width="300px" />
120-
</div>
121-
<div class="gallery-item">
122-
<img src="./serious.jpg" height="200px" width="300px" />
123-
</div>
151+
<button class="scroll-button right">></button>
124152
</div>
125153
</section>
126154
<footer>

style.css

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ body {
22
min-width: 100vw;
33
margin: 0;
44
background-color: whitesmoke;
5+
overflow-x: hidden;
56
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
67
}
78

@@ -42,11 +43,16 @@ ul {
4243
width: 80px;
4344
}
4445

46+
.gallery-wrapper {
47+
width: 100%;
48+
position: relative;
49+
}
50+
4551
.gallery {
4652
width: 100vw;
47-
overflow-x: auto;
53+
overflow-x: hidden;
4854
white-space: nowrap;
49-
padding: 20px 15px;
55+
padding: 20px 5px;
5056
border: 1px solid #ddd;
5157
scroll-behavior: smooth;
5258
}
@@ -58,10 +64,38 @@ ul {
5864
transition: transform 0.3s ease
5965
}
6066

67+
.gallery-item img {
68+
border-radius: 8px;
69+
object-fit: cover;
70+
box-shadow: 0 4px 6px rgb(0, 0, 0, 0.1);
71+
}
72+
6173
.gallery-item:hover {
6274
transform: scale(1.1);
6375
}
6476

77+
.scroll-button {
78+
position: absolute;
79+
top: 50%;
80+
transform: translateY(-50%);
81+
z-index: 10;
82+
font-size: 24px;
83+
padding: 4px 12px;
84+
background-color: rgba(0, 128, 128, 0.4);
85+
}
86+
87+
.scroll-button:hover {
88+
background-color: teal;
89+
}
90+
91+
.scroll-button.left {
92+
left: 10px;
93+
}
94+
95+
.scroll-button.right {
96+
right: 10px;
97+
}
98+
6599
form {
66100
display: flex;
67101
flex-direction: column;

0 commit comments

Comments
 (0)