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 如何通过单击在图像弹出窗口中打开图像?


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Fetch API 如何获取响应体? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07