jquery dialog属性的简单配置

记录是为了更好的成长!

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <style>
      
        .ui-widget-header { 
            background:#fff; 
            border:none;
        } 
        #dialog{margin: 0;padding:0;}
        #img{position: relative;}
  </style>
  <script>
      $( function() {
            $("#dialog").hide();
            
            $("#btn").click(function(){
                $("#dialog").dialog({
                    
                    /*buttons:{            //为弹框添加按钮,可以为不同的按钮分别定义事件    
                        "确定":function(){},
                        "取消":function(){$(this).dialog("close");}
                    },*/
                    
                    width : "600",         //宽度
                    height : "400",     //高度
                    resizable: false,    //是否可以缩放
                    fit:true,            //弹框大小根据浏览器自适应
                    autoOpen:true,        //是否打开,如果为false,弹框功能失效
                    closeOnEscape:true,    //弹框打开之后按下Esc键,true:关闭,false:无效
                    modal:true,        //与overlay配套使用,打开弹框之后浏览器窗口变色
                    overlay: {            //true:生效, false:无效
                        backgroundColor: '#ff6700',
                        opacity: 0.3,
                    },
                    open:function(event,ui){      //隐藏close "X"  关闭按钮
                        //$(".ui-dialog-titlebar-close", $(this).parent()).hide();  
                        //$(".ui-widget-header").hide();    //隐藏title
                    } ,
                });
            });
      });
  </script>
</head>
<body>
    <button id="btn" >提交</button>
     
    <div id="dialog" >
      <img id="img" src="img/2019-01-01_190941.png" width=100% height=90%>
    </div>
    
</body>
</html>

 

以上内容代表个人观点,仅供参考,不喜勿喷。。。

转载于:https://www.cnblogs.com/newbest/p/10206053.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值