اخر المواضيع

إختر لونك المفضل

عرض المحتوي

بحث

السبت، 22 فبراير 2025

Hayef-makia-1 معرض صور مميز وعداد يخرج كم صوره

السفراني | فبراير 22, 2025 |
السلام عليكم

الويب


<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ar" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>معرض الصور</title>
<link rel="stylesheet" href="styles-hayef-soer.css">
</head>
<body>
<header>
<h1>معرض الصور</h1>
<nav>
<ul>
<li><a href="#">الصفحة الرئيسية</a></li>
<li><a href="#">المعرض</a></li>
</ul>
</nav>
</header>

<main>
<div id="gallery">
<!-- صور الاحتياطية -->
<img src="maeppne-1.jpg" alt="صورة 1" data-caption="نبذة عن الصورة 1">
<img src="maeppne-2.jpg" alt="صورة 2" data-caption="نبذة عن الصورة 2">
<img src="maeppne-3.jpg" alt="صورة 3" data-caption="نبذة عن الصورة 3">
<img src="saiiiibeah1.png" alt="صورة 4" data-caption="نبذة عن الصورة 4">
<img src="saiiiibeah2.png" alt="صورة 5" data-caption="نبذة عن الصورة 5">
<img src="saiiiibeah3.png" alt="صورة 5" data-caption="نبذة عن الصورة 5">
<img src="saiiiibeah4.png" alt="صورة 5" data-caption="نبذة عن الصورة 5">

<!-- أضف المزيد من الصور هنا -->
</div>
</main>

<div id="lightbox">
<div id="lightbox-content">
<span class="close">&times;</span>
<img id="lightbox-image" src="" alt="">
</div>
</div>

<footer>
<p>تابعنا على الشبكات الاجتماعية:</p>
<div id="social-links">
<a href="#"><img src="facebook.png" alt="Facebook"></a>
<a href="#"><img src="twitter.png" alt="Twitter"></a>
<a href="#"><img src="instagram.gif" alt="Instagram"></a>
</div>
<p id="photo-count">عدد الصور: <span>5</span></p>
</footer>

<script src="styles-hayef-soer.js"></script>
</body>
</html>


الاستايل :
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}

header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}

nav ul {
list-style-type: none;
padding: 0;
}

nav ul li {
display: inline;
margin-left: 20px;
}

nav ul li a {
color: #fff;
text-decoration: none;
}

main {
padding: 20px;
}

#gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

#gallery img {
max-width: 200px;
height: auto;
margin: 10px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}

#gallery img:hover {
transform: scale(1.1);
cursor: pointer;
}

#lightbox {
display: none;
position: fixed;
z-index: 999;
padding-top: 50px;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.9);
overflow: auto;
}

#lightbox-content {
position: relative;
margin: auto;
display: flex;
justify-content: center;
align-items: center;
width: 90%;
height: 90%;
}

#lightbox-image {
max-width: 100%;
max-height: 100%;
}

.close {
color: #fff;
position: absolute;
top: 10px;
right: 25px;
font-size: 36px;
font-weight: bold;
transition: 0.3s;
cursor: pointer;
}

.close:hover,
.close:focus {
color: #999;
text-decoration: none;
}

footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}

#social-links {
margin-bottom: 10px;
}

#social-links a {
margin: 0 5px;
}

#photo-count {
margin-top: 0;
}


الجافا سكربت :
document.addEventListener("DOMContentLoaded", function() {
const photoCount = document.querySelectorAll("#gallery img").length;
document.querySelector("#photo-count span").textContent = photoCount;

const images = document.querySelectorAll("#gallery img");
const lightbox = document.getElementById("lightbox");
const lightboxImage = document.getElementById("lightbox-image");

images.forEach(img => {
img.addEventListener("click", function() {
lightbox.style.display = "flex";
lightboxImage.src = this.src;
});
});

const closeButton = document.querySelector(".close");
closeButton.addEventListener("click", function() {
lightbox.style.display = "none";
});

lightbox.addEventListener("click", function(event) {
if (event.target === lightbox) {
lightbox.style.display = "none";
}
});
});

وسلامتكم ويوجد استايل وتطوير افضل

author

ليست هناك تعليقات:

اضف تعليقك هنا