-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
106 lines (91 loc) · 2.27 KB
/
index.html
File metadata and controls
106 lines (91 loc) · 2.27 KB
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
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>گالری مخفی با زوم</title>
<style>
body {
font-family: sans-serif;
background: #f9f9f9;
text-align: center;
padding: 40px;
}
h2 {
margin-bottom: 25px;
}
/* دکمه */
.show-btn {
background: #6c63ff;
color: white;
border: none;
border-radius: 10px;
padding: 12px 30px;
cursor: pointer;
font-size: 18px;
transition: background 0.3s;
}
.show-btn:hover {
background: #5a53d6;
}
/* گالری عکسها */
.gallery {
display: none;
margin-top: 30px;
justify-content: center;
flex-wrap: wrap;
gap: 20px;
}
.zoomable {
width: 250px;
max-width: 90%;
border-radius: 10px;
transition: transform 0.4s ease;
cursor: zoom-in;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.zoomed {
transform: scale(1.8);
cursor: zoom-out;
}
.fade-in {
animation: fadeIn 0.8s ease;
}
@keyframes fadeIn {
from {opacity: 0; transform: scale(0.9);}
to {opacity: 1; transform: scale(1);}
}
</style>
</head>
<body>
<h2>برای دیدن عکسها روی دکمه زیر بزن 👇</h2>
<button class="show-btn" id="toggleBtn">نمایش عکسها</button>
<div class="gallery" id="gallery">
<img src="سبز.jpg" alt="عکس ۱" class="zoomable">
<img src="قرمز.jpg" alt="عکس ۲" class="zoomable">
<img src="گالن رنگ مشکی.jpeg" alt="عکس ۳" class="zoomable">
</div>
<script>
const btn = document.getElementById('toggleBtn');
const gallery = document.getElementById('gallery');
const images = document.querySelectorAll('.zoomable');
// باز و بسته کردن گالری
btn.addEventListener('click', () => {
if (gallery.style.display === 'flex') {
gallery.style.display = 'none';
btn.textContent = 'نمایش عکسها';
} else {
gallery.style.display = 'flex';
gallery.classList.add('fade-in');
btn.textContent = 'بستن عکسها';
}
});
// زوم روی عکسها
images.forEach(img => {
img.addEventListener('click', () => {
img.classList.toggle('zoomed');
});
});
</script>
</body>
</html>