弹框和遮罩

遮罩可以用一个半透明的高度和宽度等于页面100%的div来做。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>东方证券</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="format-detection" content="email=no"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
<style>
    *, :after, :before {
        -webkit-tap-highlight-color: transparent
    }

    blockquote, body, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, input, legend, li, ol, p, td, textarea, th, ul {
        margin: 0;
        padding: 0
    }

    body{
        background: #f2f4f3;
        color: #333333;
    }
    .content-box{
    }
    li {
        list-style: none;
    }
    .am-flexbox {
        text-align: left;
        display: -webkit-box;
        display: -webkit-flex;
        -webkit-box-align: center;
        -webkit-align-items: center;
        position: relative;
    }

    .am-flexbox .am-flexbox-item, .am-flexbox2 .am-flexbox-item {
        -webkit-box-sizing: border-box;
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        width: 20px;
        position: relative;
    }
    .weui_cell {
        padding: 5px 15px;
        font-size: 16px;
        position: relative;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        background: #ffffff;
    }
    .btn {
        min-width: 75px;
        height: 35px;
        line-height: 35px;
        font-size: 18px;
        color: #ffffff;
        text-align: center;
        border-radius: 4px;
        background: #c70e16;
    }
    .weui_cell:after {
        content: " ";
        position: absolute;
        left: 0;
        bottom:-1px;
        width: 100%;
        height: 1px;
        border-bottom: 1px solid #D9D9D9;
        color: #D9D9D9;
        -webkit-transform-origin: 0 0;
        -ms-transform-origin: 0 0;
        transform-origin: 0 0;
        -webkit-transform: scaleY(0.5);
        -ms-transform: scaleY(0.5);
        transform: scaleY(0.5);
        z-index: 100;
    }
    .am-mg-10{
        margin: 0 10px;
    }
    .am-footer {
        position: fixed;
        left: 0;
        bottom: 10px;
        width: 100%;
        text-align: center;
        z-index: 1000;
    }
    .am-footer .btn{
        margin: 0 15px;
    }

    /*弹框遮罩*/
    html,body{height:100%;}
    .dialog{
        position: relative;
        top:150px;
        border:3px solid #c70e16;
        background:white;
        height:150px;
        width:80%;
        margin-left:auto;
        margin-right:auto;
        text-align:center;
        border-radius:7px;
        z-index:10000;
    }
    .dialog_line{
        margin-top:40px;
        margin-bottom:20px;
    }
    .dialog .btn{
        width:35%;
        margin-left:auto;
        margin-right:auto;
    }
    .dialog #password{
        background:transparent;
        border:1px solid #DAD3D3;
        height:23px;
        margin-left:10px;
        border-radius:4px;
    }
    .mask{
        background: #9797A5;
        height: 100%;
        width: 100%;
        opacity: 0.8;
        z-index: 9999;
        position: fixed;
        top: 0px;
    }
</style>
</head>
<body>
<div class="content-box">
    <ul class="itme itme3  weui_cells" id="weui_cells">
        <li class="am-flexbox weui_cell">
            <div class="am-flexbox-item">融资融券-00613899</div>
            <div class="btn" onclick="showDialog(this)">签约</div>
        </li>
    </ul>
</div>
<footer class="am-footer">
    <div class="btn am-mg-10" onclick="login()">登录签约账号</div>
</footer>

<script type="text/javascript">
    //对话框
    function showDialog(obj){
        if(document.getElementById(‘dialog‘)) return;
        btn = obj;

        var dialog = document.createElement(‘div‘);
        dialog.className = "dialog";
        dialog.id = "dialog";
        dialog.innerHTML = "<div class=‘dialog_line‘><label>密码:</label><input type=‘password‘ id=‘password‘/></div><div class=‘btn am-mg-10‘ onclick=‘send()‘>确认</div>"
        mask();
        document.body.appendChild(dialog);
    }

    //遮罩
    function mask(){
        var mask = document.createElement(‘div‘);
        mask.className = "mask";
        mask.id = "mask";
        document.body.appendChild(mask);
        mask.onclick = function(){
            removeDialog();
            removeMask();
        }
    }

    function send(){
        //发送签约解约请求

        //关闭弹框
        removeDialog();
        removeMask();
    }

    function removeDialog(){
        var dialog = document.getElementById(‘dialog‘);
        if(dialog)dialog.parentNode.removeChild(dialog);
    }

    function removeMask(){
        var mask = document.getElementById(‘mask‘);
        if(mask)mask.parentNode.removeChild(mask);
    }

    //===================================================================
    String.prototype.trim=function(){
        return this.replace(/(^\s*)|(\s*$)/g,‘‘);
    }
</script>
</body>
</html>
时间: 2024-07-28 18:16:11

弹框和遮罩的相关文章

实现自己自定义的弹框和遮罩层

有的时候我们需要实现属于自己的弹框和弹出框的遮罩层效果,下面我给大家讲一下有javascript实现最简单的属于自己的弹框和弹框遮罩层效果,首先编写遮罩层的javascript,代码如下: 1.遮罩层js: //获得坐标 function getPosition() { var top = document.documentElement.scrollTop; var left = document.documentElement.scrollLeft; var height = documen

easyUI弹框被遮罩层遮挡

项目中用到easyui 布局,用到north,west,center三个区域,且在center中间区域嵌入iframe标签.在主内容区做一些小提示弹窗(例如删除前的弹窗提示确认)时,会遇到遮罩问题,由于center区域是iframe嵌套的,所以里面的小弹窗无法覆盖页面的头部和左边目录栏. 情形一.点击提示弹窗里的确认后,提示弹窗消失: //warnTips为传入的值,例如successMask("确定要删除选中的数据吗?") function successMask(warnTips)

bootstrap弹框去除遮罩层效果

是通过css解决这个问题,核心css代码如下: .modal-backdrop { filter: alpha(opacity=0)!important; opacity: 0!important; } alpha和opacity通常是决定透明度. alpha和opacity区别是什么? 相同点:都是值为0表示完全透明,值为1表示完全不透明. 不同点:alpha可以应用元素特定的属性,只能作用于当前元素,其子元素不能继承,而opacity不仅仅作用于当前元素,也会影响子元素及其子子元素,具有继承

div遮罩弹框口

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title>群组设置</title> <style> .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height:

遮罩、警告框/弹框 - EasyUI

1.遮罩 1.1. $.messager.progress //开启遮罩 $.messager.progress({}); 或 $.messager.progress({ title: 'Please waiting', msg: 'Loading data...', text: 'PROCESSING.......' }); //关闭遮罩 $.messager.progress('close'); 1.2.依赖于EasyUI控件的遮罩 //显示遮罩 $("#标签ID").标签(&qu

JS遮罩层弹框效果

对于前端开发者来说,js是不可缺少的语言.现在我开始把我日常积累的一些js效果或者通过搜索自己总结的一些效果分享给大家,希望能够帮助大家一起进步,也希望大家能够多多支持! 1.今天我先分享一个遮罩层弹框效果: <!DOCTYPE html PUBLIC "-//W3C//DTDXHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <

element-ui 弹出框在遮罩层下面

title: element-ui 弹出框在遮罩层下面 date: 2020-03-18 11:37:45 tags: elementUI 给 <el-dialog></el-dialog>添加:modal-append-to-body="false"属性 <el-dialog title="提示" :visible.sync="isDialogShow" :modal-append-to-body="fa

自己写的基于bootstrap风格的弹框插件

自己写的一款基于bootstrap风格的弹框插件,暂时只有确认框.提示框.后续功能扩展.bug修改再更新. ;(function($){ //默认参数 var PARAMS; var DEFAULTPARAMS = { width: 500, title: '提示消息', content: '', okbtn: '确定', cancelbtn: '取消', headerBackground: 'info', vbackdrop: 'static', //默认点击遮罩不会关闭modal vkeyb

弹框组件

因为项目中使用的较多,因此封装了一个组件,便于使用. /* *@file 弹框组件 *@description 用于所有提示弹框 *@time 2016/11/29 */ function PopModel(options) { var that = this; this.defaults = { width: '100px', // 默认框 height: '120px', // 默认高 isMask: true, // 是否遮罩 dir: 'mid', // mid中间,left左下,rig