-
Notifications
You must be signed in to change notification settings - Fork 1
/
portfolio.html
152 lines (138 loc) · 4.88 KB
/
portfolio.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Horizontal Scroll Gallery</title>
<style>
body {
font-family: Arial, sans-serif;
}
.gallery-container {
display: flex;
align-items: center;
overflow: hidden;
width: 100%;
position: relative;
}
.scroll-btn {
background-color: #333;
color: white;
border: none;
padding: 10px;
cursor: pointer;
z-index: 1;
}
.gallery {
display: flex;
overflow-x: hidden;
width: 80%;
margin: 0 10px;
position: relative;
}
.gallery-inner {
display: flex;
transition: transform 0.5s ease;
}
.gallery-item {
position: relative;
min-width: 200px;
margin: 0 10px;
}
.gallery-item img {
width: 100%;
height: auto;
}
.info-btn {
position: absolute;
bottom: 10px;
left: 10px;
background-color: rgba(0, 0, 0, 0.5);
color: white;
border: none;
padding: 5px;
cursor: pointer;
}
.info {
display: none;
position: absolute;
bottom: 40px;
left: 10px;
background-color: rgba(0, 0, 0, 0.8);
color: white;
padding: 10px;
width: 180px;
}
</style>
</head>
<body>
<div class="gallery-container">
<button class="scroll-btn left-btn" onclick="scrollGallery('left')">◀</button>
<div class="gallery">
<div class="gallery-inner" id="galleryInner">
<div class="gallery-item">
<img src="media\chadcat.jpg" alt="Image 1">
<button class="info-btn" onclick="toggleInfo('info1')">More Info</button>
<div class="info" id="info1">
<p>Details about Image 1</p>
</div>
</div>
<div class="gallery-item">
<img src="media\portfolio\revolver.gif" alt="Image 2">
<button class="info-btn" onclick="toggleInfo('info2')">More Info</button>
<div class="info" id="info2">
<p>Dniga etails about Image 2</p>
</div>
</div>
<div class="gallery-item">
<img src="media\portfolio\revolver.gif" alt="Image 3">
<button class="info-btn" onclick="toggleInfo('info2')">More Info</button>
<div class="info" id="info2">
<p>Dniga etails about Image 2</p>
</div>
</div>
<div class="gallery-item">
<img src="media\portfolio\revolver.gif" alt="Image 4">
<button class="info-btn" onclick="toggleInfo('info2')">More Info</button>
<div class="info" id="info2">
<p>Dniga etails about Image 2</p>
</div>
</div>
<div class="gallery-item">
<img src="media\portfolio\revolver.gif" alt="Image 5">
<button class="info-btn" onclick="toggleInfo('info2')">More Info</button>
<div class="info" id="info2">
<p>Dniga etails about Image 2</p>
</div>
</div>
<!-- Add more gallery items as needed -->
</div>
</div>
<button class="scroll-btn right-btn" onclick="scrollGallery('right')">▶</button>
</div>
<script>
const galleryInner = document.getElementById('galleryInner');
let scrollAmount = 0;
const itemWidth = 220; // Width of the image plus margin
function scrollGallery(direction) {
const maxScroll = galleryInner.scrollWidth - galleryInner.clientWidth;
if (direction === 'left') {
scrollAmount -= itemWidth;
if (scrollAmount < 0) {
scrollAmount = maxScroll;
}
} else if (direction === 'right') {
scrollAmount += itemWidth;
if (scrollAmount > maxScroll) {
scrollAmount = 0;
}
}
galleryInner.style.transform = `translateX(-${scrollAmount}px)`;
}
function toggleInfo(infoId) {
const info = document.getElementById(infoId);
info.style.display = (info.style.display === 'block' || info.style.display === '') ? 'none' : 'block';
}
</script>
</body>
</html>