Simple modal div in jQuery?(jQuery中的简单模态div?)
问题描述
我已经尝试了几乎所有可以在网上找到的 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:jQuery中的简单模态div?


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