HTML - JS How to open an image in an image popup by clicking on it?(HTML - JS 如何通过单击在图像弹出窗口中打开图像?)
问题描述
我应该在 html
或 javascript
或其他代码中编写一些代码,以通过单击图像打开弹出窗口.我已经看过 window.open()
方法,但这不是我想要的.确切地说,我想像 Twitter 那样打开一个图像弹出窗口:遮盖背景并在屏幕中间显示放大的图像.
I should write some code in html
or javascript
or other to open a popup window by clicking on an image.
I have already seen the window.open()
method, but this isn't what I am looking for.
Precisely I want to open an image popup like Twitter does: overshadowing the background and displaying the image enlarged in the middle of the screen.
有什么建议吗?
推荐答案
你可以用灯箱来做.
这个链接有一个简单的例子:
There is a simple example in this link:
http://lokeshdhakar.com/projects/lightbox2/
这篇关于HTML - JS 如何通过单击在图像弹出窗口中打开图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:HTML - JS 如何通过单击在图像弹出窗口中打开图像?


基础教程推荐
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01