Dynamic Image Gallery
About this app
A vibrant image gallery showcasing favorite images with fun effects and animations, fully responsive and user-friendly.
Dynamic Image Gallery Dynamic Image Gallery ×
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Dynamic Image Gallery</title>
<meta name="description" content="A vibrant image gallery showcasing favorite images with fun effects and animations, fully responsive and user-friendly.">
<meta name="keywords" content="image gallery, pictures, responsive design, animations, CSS, JavaScript">
<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">
<script type="text/javascript">
try {
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
const images = [
'https://via.placeholder.com/300/FF5733/FFFFFF?text=Image+1',
'https://via.placeholder.com/300/33FF57/FFFFFF?text=Image+2',
'https://via.placeholder.com/300/3357FF/FFFFFF?text=Image+3',
'https://via.placeholder.com/300/FF33A1/FFFFFF?text=Image+4'
];
const galleryContainer = document.getElementById("gallery");
images.forEach((src, index) => {
const imgElement = document.createElement("img");
imgElement.src = src;
imgElement.className = "img-fluid rounded m-2 hover-img";
imgElement.alt = `Image ${index + 1}`;
imgElement.onclick = () => showModal(src);
galleryContainer.appendChild(imgElement);
});
});
function showModal(imageSrc) {
const modal = document.getElementById('image-modal');
const modalImg = document.getElementById("modal-img");
modal.style.display = "block";
modalImg.src = imageSrc;
}
function hideModal() {
const modal = document.getElementById('image-modal');
modal.style.display = "none";
}
} catch (error) {
throw error;
}
</script>
<style>
body {
background-color: #f0f8ff;
font-family: 'Arial', sans-serif;
}
#gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 20px;
}
.hover-img {
transition: transform 0.3s;
}
.hover-img:hover {
transform: scale(1.05);
cursor: pointer;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.9);
padding-top: 60px;
}
.modal-content {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
}
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1 class="text-center my-4">Dynamic Image Gallery</h1>
<div id="gallery"></div>
<div id="image-modal" class="modal">
<span class="close" onclick="hideModal()">×</span>
<img class="modal-content" id="modal-img">
</div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!