Create A Responsive Popup Image Gallery Using HTML CSS And Vanilla Javascript

preview_player
Показать описание
how to make a simple responsive lightbox image gallery using html css and vanilla javascript.
create a image popup gallery on click using vanilla javascript.

images are from unsplash:

New To My Channel Subscribe Now And See More Stuff Like This:

#ImageGallery
#LightboxGallery
#Javascript
Рекомендации по теме
Комментарии
Автор

Awesome and very efficiently explained. This was exactly the video I was looking for. Thanks a ton for the help. Subscribed happily!

tenc
Автор

Nice; however, I‘d like to also see the prev and next ARROWS, especially for mobile devices.

toma
Автор

exclente vidio, it´s so usefull, sorry for mi writing im from argentina
tremendo muchas gracias

pepey
Автор

after refreshing or reloading the popup image is not collapsing...

MuraliKrishna-wnbf
Автор

Simple Easy Fast Forward... so nice tutorial

nuraktar
Автор

Nice Sir This Video Very Useful Sir Thank You Sir🤩

mosesimmanuel
Автор

It's beautiful Mr. Web Designer. Very well explained e easy entendment. Please continue in the videos!!
Thanks and sucess ever

rafaelmariano
Автор

Here is a new request for upcoming video: make a pop up image viewer with next and previous img button using css, vanilla js

nuraktar
Автор

Thank you for your tutorial it worked like a charm!
I don't want to bother but do you know how to add caption for every image in the popup view? I'm trying to use figcaption to pass through the .popup-image but I'm not getting it. I also made a Stack Overflow's post but they marked as a duplicate (and the marked previously post didn't respond my question).
Please if you could help me I'd be so glad.

keroppisapo
Автор

How to use this method to view specific product details of ecommerce website?

janithjayasinghe
Автор

Cool man!! I'm stuck with a circular gallery but this video really opens my a path 👌

julioarmandoramires
Автор

Thank you, it allowed me to understand and to adapt the code to my website.🛠

guillaumevandeville
Автор

Thanks very much for this video. Awesome

SamuelSilva-tzks
Автор

From unsplash website at what resolution we have to download for image gallery

pallavipradhan
Автор

Very efficiently explained. Thanks for help, Subscribed❣

kinglucky
Автор

i know i'm 2 years late to this video, but i coded an area underneath the pop-up images where a title, date and description would appear, pulling from the hidden h4 and p tags in the square with the id function
problem is, i can only have the title and description of the first image appear, and it'll display that same title and description under all the images
i was wondering if there's a certain way to have it so that the title and description changes independently for each image?

JPiXeL
Автор

You're awesome! Thank you very very much!!

delforjf
Автор

When I click on the 2nd image the 1st image popup shows up anyone else have this issue ?

cameronfletcher
Автор

did I do it right? (empty img srcs)

<html>
<head>
<style>
* {
margin:0; padding:0;
box-sizing: border-box;
}

.container{
position: relative;
min-height: 100vh;
background: white;
}

.container .image-container{
display: flex;
flex-wrap: wrap;
gap:15px;
justify-content: center;
padding: 10px;
}

.container .image-container .image{
height: 250px;
width: 350px;
border:10px solid white;
box-shadow: 0 5px 15px black;
overflow:hidden;
cursor: pointer;
}

.container .image-container .image img{
height:100%;
width:100%;
object-fit: cover;
transition: .2s linear;
}
.container .image-container .image:hover img{
transform: scale(1.1);
}

.container .popup-image{
position: fixed;
top:0; left:0;
background: black;
height:100%;
width:100%;
z-index:100
}
.container .popup-image span{
position: absolute;
top:0; right:10px;
font-size: 40px;
font-weight: bolder;
color: white;
cursor: pointer;
z-index: 100;
}

.container .popup-image img{
position: absolute;
top: 50%; left:50%;
transform: translate(-50%, -50%);
border:5px solid white;
border-radius: 5px;
width:750px;
object-fit: cover;
}

@media (max-width:768px){
.container .popup-image img{
width:95%;
}



<body>

<div class="image-container">
<div class="image"><img src="" alt=""></div>
<div class="image"><img src="" alt=""></div>
<div class="image"><img src="" alt=""></div>
<div class="image"><img src="" alt=""></div>
<div class="image"><img src="" alt=""></div>
<div class="image"><img src="" alt=""></div>
</div>

<div class="popup-image">
<span>&times;</span>
<img src="" alt="">
</div>

</div>

<script>

img').foreach(image =>{
image.onclick = () =>{}
= 'block';
img').src = image.getattribute('src');
}

});

span').onclick = () =>{
= 'none';
}

</script>

</body>
</html>

erob