zoukankan      html  css  js  c++  java
  • 弹出对话框+背景为灰色

    比如像这样的页面,前段时间自己在写的时候不是很会,然后问了学姐,然后自己上网查找了下资料。然后知道了这样的写法。上面是这样的效果。

    讲解:

    在上面点击第二张中的“点击获取优惠券”然后弹出这样的对话框,背景变成灰色。

    第二个页面就不讲解了,关键是第一个页面

    <div class="content">            
            <div class="Phone" style="display: none;"> <div class="ph"></div> <div class="bg"></div>  </div>
    </div>

    HTML

    	     showPhone : function(){
    						if(true){
    						 //console.log(1111);
    							var html = '';
    								html += '<div class="item">'
    								 + '<div class="title">'+ "请输入正确的手机号" +'</div>'
    								 + '<img src="images/aa.png" class="cancel" onclick="page_coupons.hidPhone()">'
    								 + '<input type="text" name="phone" class="phone">'
    								 + '<div class="confirm" onclick="$Common.tocouponsDetail()">' + "确认"
    								 + '</div>'
    								 + '</div>';
    							$('#page_coupons .content .Phone').css('display','block');
    							$('#page_coupons .content .Ph').html(html);
    						}
    	     }
    

     JS

    #page_coupons .bg {
         100%;
    	z-index:10;
    	opacity:0.7; 
    	background:#6F7C84; 
    	position: fixed;
    	top:0px;
    	bottom: 0px;
    }
    
    #page_coupons .content .ph {
       	z-index:11;
    	 80%;
    	border-radius : 6px;
    	background-color: #DEDEDC;
    	position: fixed;
    	top:40%;
    	left:10%;
    }
    
    #page_coupons .content .Phone .item  {
        border-top: 1px solid #9B9B99;
    	padding: 2%;
    	text-align: center;
    	color:#4D4948;
    	font-size: 16px;
    	font-weight: bold;
    }
    
    #page_coupons .content .Phone .item .confirm {
       color : #3B335B;
       font-weight : bold;
       margin : 3px 37%;
       padding-top : 4px;
       border-radius : 3px;
       background : #F8C301;
    }
    
    #page_coupons .content .Phone .item .cancel {
       width : 8%;
       float : right;
       margin-top : -28px;
       margin-right : -14px;
    }
    
    #page_coupons .content .Phone .item  .phone {
       margin-top : 12px;
    }
    

     CSS

    当点击的时候这个事件我就不写了,点击的时候调用这个函数就行啦!

    当点击之前设置"Phone"为不可见('displey','none'),当点击后设置为('display','block' )

    然后将要显示的div添加在Ph后就行啦,这样效果就出来了!

    /////////////////////////////////////////纯属个人理解,还请多多指教///////////////////////////////////////////////////////

  • 相关阅读:
    ArcGIS Engine 常用方法(转)
    正则表达式 C#System.Text.RegularExpressions.Regex
    ae中栅格数据转为矢量数据 (转)
    ArcEngine 渲染的使用 (转)
    C#字符串分割成数组,中间多空格
    <C++ GUI Programming with Qt4 ,Second Edition> 学习笔记
    perl module and its package
    static_cast reinterpret_cast
    阅读<inside the c++ object modle > 有感
    C++ virtual table
  • 原文地址:https://www.cnblogs.com/ACMxike20111726/p/3385036.html
Copyright © 2011-2022 走看看