pop 弹框 窗口

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>商品订单</title>
  <script src="jquery-3.3.1.min.js"></script>
	<style> 
     	/* 弹框的有样式 */
       .pop{
         	max-width:700px;
         	background-color:#ffffff;        
         	padding:20px;          
          box-shadow:0 0 20px 3px rgba(0,0,0,0.4);
          border-radius: 5px;
          display:none;
          position:absolute;  
          z-index:110;      
       }
       .cancel{
       	    width:100%;
       	    height:30px;
       }
	       .cancel img{
	       	width:25px;
	       	height:25px;
	       	float:right;
       }
        .pop p{
        	width:100%;
        	height:40px;
        	text-align:center;
          line-height:40px;
        }
        .pop p:nth-of-type(1){
        	color:#1FA1DF;
        	font-size:18px;
        	font-weight:bold;

        }
         .pop p:nth-of-type(2){
         	color:#333333;
         	font-size:14px;
         }
         .pop p:nth-of-type(2) span{
         	color:#f00;
         }
         .pop p:nth-of-type(3){
          color:#333333;
          font-size:18px;
          font-weight:bold;
         }
         .pop .button{
          width:64%;  
          height:40px;
          margin:40px auto 20px;       
         }
         .pop .button a{
          display:block;
          float:left;
          width:140px;
          height:40px;
          text-align:center;
          line-height:40px;
          text-decoration:none;
          font-size:14px;
          border-radius: 6px;
         }
         .pop .button a:nth-of-type(1){
          color:#333;
          background-color:#f2f2f2;
         }
          .pop .button a:nth-of-type(2){
          color:#ffffff;
          background-color:#169BD5;
          margin-left:50px;
         }
      /*点击按钮*/
       .clickBtn{
          display:block;
          width:150px;
          height:40px;
          line-height:40px;
          background-color:#ccc;
          text-align:center;
          text-decoration: none;
          color:#fff;
       }
       #mb{
          width:100%;
          height:100%;
          background-color:rgba(0,0,0,0.3);
          position:fixed;
          top:0;
          left:0;
          z-index:100;
          display:none;
       }
	</style>
</head>
<body>
<!-- jquery的样式写法 -->
  <a href="javascript:;" class="clickBtn" id="clickBtn" onclick="pop()">点击事件</a> 
  <div id="mb"></div>
	<div class="pop" id="pop">	  
		<p>该功能需要付费升级后使用</p>
		<p>该账号目前为普通账号,不能使用<span>商城、</span><span>防伪、</span><span>促销</span>功能,徐付费升级后才能使用。</p>
		<p>1999元/年</p>
		<div class="button">
      <a href="#" onclick="stop();">取消</a>			
			<a href="#">我要升级</a>
		</div>
	</div>
  <!-- 原生的样式写法 -->
  <!-- <a href="javascript:;" class="clickBtn" id="clickBtn">点击事件</a>
  <div id="mb"></div>
  <div class="pop" id="pop">    
    <p>该功能需要付费升级后使用</p>
    <p>该账号目前为普通账号,不能使用<span>商城、</span><span>防伪、</span><span>促销</span>功能,徐付费升级后才能使用。</p>
    <p>1999元/年</p>
    <div class="button"> 
      <a href="#" id="close">取消</a>
      <a href="#">我要升级</a>
    </div>
  </div> -->
</body>
<script> 
  function stop() {
    $('#mb').toggle();
    $('.pop').toggle();
  }

  function pop() {
      $('#mb').toggle();
      $('.pop').toggle();
      if ($(window).width() < 800) {
          $(window).width(800);
      }
      var left = $(window).width() / 2 - $('.pop').width() / 2;
      var top = $(window).height() / 2 - $('.pop').height() / 2;
      $('.pop').css({ 'left': left, 'top': top });
  }
 
</script>

<script>
 /*原生弹框的写法*/
  /*var mb = document.getElementById('mb');
  var pop = document.getElementById('pop');
  var clickBtn = document.getElementById('clickBtn');
  var close = document.getElementById('close');

  function showpop(){  
    pop.style.display = 'block';
    mb.style.display = 'block';
    var dW = document.documentElement.clientWidth;
    if(dW<=800){
      dW = 800;
    }
    var dH = document.documentElement.scrollHeight;
    mb.style.width = dW+'px';
    mb.style.height = dH+'px';
    var newLeft = document.documentElement.clientWidth/2 - pop.offsetWidth/2;
    var newTop = document.documentElement.clientHeight/2 - pop.offsetHeight/2;
    pop.style.left = newLeft +'px';
    pop.style.top = newTop +'px';
  }

  clickBtn.onclick = function(){  
    showpop();
  }
  window.onresize = function(){
    if(pop.style.display == 'block'){
      showpop();
    }   
  }  
  close.onclick = function(){
    mb.style.display = 'none';
    pop.style.display = 'none';
  }*/
</script>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Flutter中有多种方式来创建弹框。其中一种常见的方式是使用AlertDialog组件来构建一个简单的弹框。可以通过showDialog函数触发弹框的显示。在showDialog函数中,可以设置barrierDismissible来决定是否点击弹框外部区域可以关闭弹框,设置barrierColor来定义屏障的颜色,设置barrierLabel来给屏障定义一个字符串名称,还可以设置anchorPoint来偏移整个弹出的位置。 另外,还可以使用showCupertinoDialog和CupertinoAlertDialog来创建弹框,或者使用SimpleDialog来创建一个简单的弹框。对于自定义的弹框,可以根据需要加入gif图片等效果。 例如,最简单的方案是利用AlertDialog组件构建一个弹框。示例代码如下: ```dart void alertDialog(BuildContext context) async { var result = await showDialog( barrierDismissible: false, context: context, builder: (context) { return AlertDialog( title: const Text("提示信息!"), content: const Text("您确定要删除吗"), actions: [ TextButton( onPressed: () { print("ok"); Navigator.of(context).pop("ok"); }, child: const Text("确定"), ), TextButton( onPressed: () { print("cancel"); Navigator.of(context).pop("取消"); }, child: const Text("取消"), ), ], ); }, ); print("-----------"); print(result); } ``` 除了AlertDialog,还可以使用SimpleDialog来创建弹框,具体用法可以参考相关文档。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [【Flutter】【弹窗】弹窗的快速上手使用和自定义Dialog](https://blog.csdn.net/weixin_43444734/article/details/127481395)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [【Flutter入门到进阶】Flutter基础篇---弹窗Dialog](https://blog.csdn.net/u010687761/article/details/129358724)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值