jQuery:如何在单击缩略图时显示图像弹出窗口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2063199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 12:41:27  来源:igfitidea点击:

jQuery: How can I show an image popup onclick of the thumbnail?

jqueryjquery-pluginspopup

提问by dexter

In my aspx page I have a thumbnail image <img>. When the user clicks on that image I would like a popup to show that blocks out the rest of the UI with the larger (full) version of the image.

在我的 aspx 页面中,我有一个缩略图<img>。当用户单击该图像时,我想要一个弹出窗口来显示该图像的较大(完整)版本挡住了 UI 的其余部分。

Are there any plugins that can do this?

有没有插件可以做到这一点?

回答by rahul

There are a lot of jQuery plugins available for this

有很多 jQuery 插件可用于此

Thickbox

厚盒

LightBox

灯箱

FancyBox

花式盒子

FaceBox

面盒

NyroModal

尼龙模态

PiroBox

PiroBox

Thickbox Examples

厚盒示例

For a single image

对于单个图像

  1. Create a link element ()
  2. Give the link a class attribute with a value of thickbox (class="thickbox")
  3. Provide a path in the href attribute to an image file (.jpg .jpeg .png .gif .bmp)
  1. 创建链接元素 ()
  2. 给链接一个类属性,值为thickbox (class="thickbox")
  3. 在 href 属性中提供图像文件的路径 (.jpg .jpeg .png .gif .bmp)

回答by fastsoft

I like prettyPhoto

我喜欢漂亮照片

prettyPhoto is a jQuery lightboxclone. Not only does it support images, it also support for videos, flash, YouTube, iframes and ajax. It's a full blown media lightbox

PrettyPhoto 是一个 jQuery灯箱克隆。它不仅支持图片,还支持视频、flash、YouTube、iframes 和 ajax。这是一个完整的媒体灯箱

回答by user9869932

Sorry for posting on such an old thread. I was in a same situation and I found a different solution that worked better for me (I didn't have to code)

很抱歉在这样一个旧线程上发帖。我遇到了同样的情况,我找到了一个更适合我的不同解决方案(我不必编码)

WOWslider

魔兽世界

Best of luck

祝你好运

回答by Morteza Ziyae

This is the most popular (9500 stars) and light weight (20KB minify, 7.5KB minify+gzip) popup gallery I think: Magnific-Popup

这是我认为最受欢迎(9500 颗星)和轻量级(20KB minify,7.5KB minify+gzip)的弹出库: Magnific-Popup

回答by Tran Tuan Anh

prettyPhoto is a jQuery lightbox clone. Not only does it support images, it also support for videos, flash, YouTube, iframes and ajax. It's a full blown media lightbox

PrettyPhoto 是一个 jQuery 灯箱克隆。它不仅支持图片,还支持视频、flash、YouTube、iframes 和 ajax。这是一个完整的媒体灯箱