如何在点击弹出窗口中显示图像(How to show an image in a popup on click)

编程入门 行业动态 更新时间:2024-10-26 04:21:24
如何在点击弹出窗口中显示图像(How to show an image in a popup on click)

我有一个简单的手风琴,它有三个分类一,分类二,分类三。所有这三个分区都有一些图像,我想实现的是当我点击手风琴的任何图像时,该图像应显示在一个高度增加的弹出窗口。可以帮助我。任何帮助都非常感谢。谢谢。

示例小提琴

I am having a simple accordion which has three divs Category One,Category Two,Category Three.All the three divs have some images , whaT i want to achieve is that when I click on any image from the accordion , that image should be displayed in a popup with its height width increased.Can any one help me out.Any help is much appreciated.Thanks.

Example Fiddle

最满意答案

这是一个没有任何插件帮助的小提琴: http : //jsfiddle.net/SzR6h/25/

回答你的评论

假设你的大图像有一个完全不同的名字,我会把这个名字放在图像标签中的data - * - Attribute中,例如

<img src="http://0.s3.envato.com/files/19320511/Scenery%2080x80%20Avatar.png" data-image-big="url_to_image_big"/>

在您的javaScript中,您可以通过编写以下内容来获取图像URL:

var urlBigImage = $img.data('image-big');

Here's a fiddle without any help of a plugin: http://jsfiddle.net/SzR6h/25/

Answer to your comment

Assume that your bigger images have a completely different name, I'd put that name in a data-*-Attribute in the image tag, e.g.

<img src="http://0.s3.envato.com/files/19320511/Scenery%2080x80%20Avatar.png" data-image-big="url_to_image_big"/>

In your javaScript, you can then get image URL by writing:

var urlBigImage = $img.data('image-big');

更多推荐

本文发布于:2023-08-07 19:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   图像   窗口中   如何在   popup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!