美文网首页
弹出层案例

弹出层案例

作者: 李华炎 | 来源:发表于2019-06-24 00:12 被阅读0次
<style type="text/css">
  /*遮罩层*/
  .v-masklayer {
      position: absolute;
      top: 0px;
      bottom: 0px;
      left: 0px;
      right: 0px;
      background-color: #000000;
      opacity: 0.3;
  }
  
  /*弹框样式*/
  .v-popup-wrap{
      width: 600px;
      height: 300px;
      position: absolute;
      border: 1px solid #E8E8E8;
      border-radius: 5px;
      background-color: #FFFFFF;
      top: 50%;
      left: 50%;
      margin-top: -150px;
      margin-left: -300px;
      padding: 10px 20px;
      color: #333333;
      font-size: 14px;
      font-family: "微软雅黑";
      box-sizing: border-box;
  }
  
  
  /*头部样式*/
  .v-header {
      position: relative;
      border-bottom: 1px solid #E8E8E8;
  }
  .v-title{
      line-height: 1;
      font-size: 16px;
      padding: 10px 35px 10px 0px;
      padding-right: 35px;
  }
  .v-close {
      width: 20px;
      height: 20px;
      line-height: 1;
      font-size: 18px;
      color: #D3D3D3;
      text-align: center;
      margin-top: -10px;
      cursor: pointer;
      position: absolute;
      top: 50%;
      right: 0px;
  }
  
  /*内容*/
  .v-content{
      max-height: 200px;
      overflow-y: scroll;
  }
  
  
  /*尾部样式*/
  .v-footer {
      width: 100%;
      position: absolute;
      bottom: 10px;
      left: 0px;
      box-sizing: border-box;
  }
  .v-footer .v-ctrl {
      margin: 0px 20px;
      padding-top: 10px;
      border-top: 1px solid #E8E8E8;
  }
  .v-footer .btn{
      display: inline-block;
      border: 1px solid #E8E8E8;
      border-radius: 15px;
      padding: 5px 20px;
      float: right;
      cursor: pointer;
  }
  .v-footer .on{
      background-color: #07a0FF;
  }
  .v-footer .v-cancel{
      margin-left: 10px;
  }


  /*清楚浮动*/
  .v-clearfix:after,.v-clearfix:before {
      content: "";
      display: block;
      zoom: 1;
  }
  .v-clearfix:after{
      clear: both;
  }
</style>

<div class="v-header">
  <div class="v-title">
      <span>我是标题客服经理开始</span>
  </div>
  <div class="v-close v-cancel">
      <span>x</span>
  </div>
</div>

<div class="v-content">
  <div class="v-info">
      我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容
  </div>
</div>

<div class="v-footer">
  <div class="v-ctrl v-clearfix">
      <div class="btn v-cancel">取消</div>
      <div class="btn v-save on">确定</div>
  </div>
</div>
(function(win, $){
    /**
     * 为window绑定一个对象(Popups),该对象的作用是生成一个弹出层
     * @param {Object} options 初始化时传递给构造函数的初始值
     */
    win.Popups = {
        open: function(options){
            options = options || {};
            this.title = options.title;
            this.content = options.content;
            this.init();
        },
        init: function(){
            var _this = this;
            
            $('body').append('<div id="v_maskLayer" class="v-masklayer"></div>');
            $('body').append('<div id="v_popup_wrap" class="v-popup-wrap"></div>');
            $('#v_popup_wrap').load('./mainContent.html', function(){
                console.log(1)
            });
            
            _this.event();
        },
        event: function(){
            var _this = this;
            
            $('#v_popup_wrap').off('click').on('click', '.v-save', function(){
                                
            });
            
            $('#v_popup_wrap').off('click').on('click', '.v-cancel', function(){
                _this.closePopup();
            });
        },
        closePopup: function(){
            $('body').find('#v_popup_wrap').remove();
            $('body').find('#v_maskLayer').remove();
        }
    };
    
    
    
})(window,jQuery);

相关文章

  • 弹出层案例

  • 子组件向父传参 .$emit的使用

    案例背景:子组件是一个弹出层,点击父组件显示弹出层,子组件按钮控制弹出层的隐藏 父组件: @closeAddres...

  • iframe调用父方法

    案例:iframe里有一个按钮,点击会弹窗,弹出来遮罩层只会覆盖iframe区域,弹出只会在iframe中间,会很...

  • js特效篇---弹出层

    JS弹出层效果案例实现视频教程-慕课网 http://www.imooc.com/learn/58

  • 弹出层

    模拟百度登陆页面

  • 微信小程序用户滑动体验处理

    问题1:当页面出现弹出层,弹出层和底层均有滚动条,滚动弹出层,底层跟着滚动(滚动穿透) 处理:该问题原因是弹出层的...

  • click点透

    什么是click点透? 核心代码: 链接 弹出 弹出层 关闭 点击弹出层,touch事件首...

  • 弹出层Layer

    弹出层控件比较好用的有layer

  • VUE 弹出层

    这些都是做移动端经常用到的的弹出层,四种弹出层,分别默认值type 0 1 2 这是一个组件 layer.vue ...

  • layer弹出层获取父级变量值的问题

    前言:项目弹出层用的都是layer的弹出层,以前只会弹出两层所以没有出现这样的问题,现在需求变化了要弹出多层 1....

网友评论

      本文标题:弹出层案例

      本文链接:https://www.haomeiwen.com/subject/gfegqctx.html