jQuery中的简单模式div? [英] Simple modal div in jQuery?

查看:124
本文介绍了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?

推荐答案

我不知道你在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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆