我已经尝试了几乎所有可以在网上找到的 jQuery Modal 插件,但对于我需要的东西来说,它们都非常笨重.我不需要所有花哨的功能,我希望能够打开一个 div 并让页面的背景像下面的照片一样变成透明的灰色,并让我的 div 在它上面,这就是我需要做的一切所以我想写一些 jQuery 来做这件事,而不是使用笨重的插件.有没有人有任何可以完成这项任务的小代码?透明背景是图像还是 CSS?
I have tried almost all of the jQuery Modal plugins I can find on the net but they are all much to bulky for what I need. I don't need all the fancy features, I want to be able to open a div and have the background of the page go transparent grey like the photo below and have my div be on top of it, that is all I need to do so I would like to write some jQuery to do this instead of using a bulky plugin. Does anyone have any small code that can do this task? Is the transparent background an image or just CSS?
这显然已经过时了.所以请参考下面的 Andrew Odri 帖子.
我不知道你在 CSS 和 JavaScript 方面有多好,但你的要求应该不难做到.
I don't know how good you are in CSS and JavaScript, but your request shouldn't be that hard to do yourself.
body, html { margin:0; padding:0; }
#modalTabelGray
{
position:absolute;
width:100%;
height:100%;
background-color:#000000;
filter:alpha(opacity=60);
opacity:0.6;
-moz-opacity:0.6;
z-index:100;
text-align:center;
vertical-align:middle;
}
#modalDiv
{
position:absolute;
z-index:101;
}
我没有测试过代码,可能无法工作,但你会明白的.
I haven't tested the code, might not work, but you'll get the idea.
这篇关于jQuery中的简单模态div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!