简体   繁体   English

(Html/css) 通过单击图库中的图像弹出图像 slider

[英](Html/css) Pop-up image slider by clicking an image in gallery

I have a grid image gallery for a collection of projects.我有一个用于项目集合的网格图像库。 By clicking each image, I want it to have a pop-up image slideshow that shows more images that are not in the gallery.通过单击每个图像,我希望它有一个弹出图像幻灯片,显示更多不在图库中的图像。 So people can see more details about a particular project.因此,人们可以看到有关特定项目的更多详细信息。

Is it possible to do that with hrml/css/javascript?是否可以使用 hrml/css/javascript 做到这一点? I'm building it on Tumblr so functions are limited.我在 Tumblr 上构建它,所以功能有限。 Below is the very basic html/css of the grid image gallery.下面是网格图像库的非常基本的 html/css。 How should I continue from that on?从那以后我应该如何继续?

 div.gallery { border: 20px solid #ccc; } div.gallery:hover { border: 20px solid #777; } div.gallery img { width: 100%; height: auto; } div.desc { padding: 15px; text-align: center; }.responsive { padding: 0 6px; float: left; width: 24.99999%; } @media only screen and (max-width: 700px) {.responsive { width: 49.99999%; margin: 6px 0; } } @media only screen and (max-width: 500px) {.responsive { width: 100%; } }.clearfix:after { content: ""; display: table; clear: both; }
 <div class="responsive"> <div class="gallery"> <a target="_blank" href="img_1.jpg"> <img src="iimg_1.jpg" alt="Cat" width="600" height="600"> </a> </div> </div> <div class="responsive"> <div class="gallery"> <a target="_blank" href="img_2.jpg"> <img src=""img_2.jpg"" alt="Forest" width="600" height="600"> </a> </div> </div> <div class="responsive"> <div class="gallery"> <a target="_blank" href="img_3.jpg""> <img src="img_3.jpg" alt="Lights" width="600" height="600"> </a> </div> </div> <div class="responsive"> <div class="gallery"> <a target="_blank" href="img_4.jpg"> <img src="img_4.jpg" alt="Sea" width="600" height="600"> </a> </div> </div> <div class="clearfix"></div>

if you want to open new gallery by clicking on a button/link you can write a JavaScript function which will display every element you want in the DOM.如果您想通过单击按钮/链接打开新画廊,您可以编写 JavaScript function 它将在 DOM 中显示您想要的每个元素。

So, on click add new element to HTML from JS and display provided elements.因此,单击从 JS 向 HTML 添加新元素并显示提供的元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM