The black_overlay class is the layer that will make the web page seem to fade. It’s a black 80% opaque background as long and wide as the browser that will overlay the web page (look at the z-index) and at the moment is not shown (look at the display).
The white content class is the layer with the photo/login screen/whatever you want to appear in the Lightbox overlay. It’s a white layer to be placed over the black_overlay layer (look at the z-index, greater than the black_overlay one). The overflow allows you to have a scrollable content.
In the html file, put this line just before the tag
<div id="light" class="white_content">Hi, I am an happy lightbox</div><div id="fade" class="black_overlay"></div>
Now, trig the action you want to open the Lightbox and insert this code:
发布评论
评论(1)
让我们从 CSS 开始。
black_overlay 类是使网页看起来褪色的图层。它是一个与浏览器一样长和宽的黑色 80% 不透明背景,它将覆盖网页(查看 z-index),但目前尚未显示(查看显示屏)。
白色内容类是包含照片/登录屏幕/您想要在灯箱叠加层中显示的任何内容的图层。它是一个白色层,放置在 black_overlay 层上(查看 z 索引,大于 black_overlay 层)。溢出允许您拥有可滚动的内容。
在 html 文件中,将此行放在标记之前
现在,触发要打开灯箱的操作并插入以下代码:
例如,在链接中将是:
完整的示例页面可以是
Let’s start with the CSS
The black_overlay class is the layer that will make the web page seem to fade. It’s a black 80% opaque background as long and wide as the browser that will overlay the web page (look at the z-index) and at the moment is not shown (look at the display).
The white content class is the layer with the photo/login screen/whatever you want to appear in the Lightbox overlay. It’s a white layer to be placed over the black_overlay layer (look at the z-index, greater than the black_overlay one). The overflow allows you to have a scrollable content.
In the html file, put this line just before the tag
Now, trig the action you want to open the Lightbox and insert this code:
For example, in a link would be:
A complete example page could be