HTML - JS 如何通过单击在图像弹出窗口中打开图像?

2022-01-20 00:00:00 image popup html

我应该在 htmljavascript 或其他代码中编写一些代码,以通过单击图像打开弹出窗口.我已经看过 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/

相关文章