layui弹出层

  1. 弹出层【重点】

  1. layer.alert

layui弹出层_第1张图片

  1. layer.confirm

layui弹出层_第2张图片

layui弹出层_第3张图片

  1. layer.prompt

layui弹出层_第4张图片

layui弹出层_第5张图片

  1. layer.tab

layui弹出层_第6张图片

layui弹出层_第7张图片

  1. layer.photos(options)

layui弹出层_第8张图片

json要求

{

  "title": "相册标题",

  "id": 123,

  "start": 0,

  "data": [  

    {

      "alt": "图片名1",

      "pid": 5,

      "src": "resources/images/img1.jpg",

      "thumb": "resources/images/img1.jpg"

    },

    {

      "alt": "图片名3",

      "pid": 1,

      "src": "resources/images/img3.jpg",

      "thumb": "resources/images/img3.jpg"

    },

    {

      "alt": "图片名4",

      "pid": 2,

      "src": "resources/images/img4.jpg",

      "thumb": "resources/images/img4.jpg"

    },

    {

      "alt": "图片名5",

      "pid": 3,

      "src": "resources/images/img5.jpg",

      "thumb": "resources/images/img5.jpg"

    },

    {

      "alt": "图片名6",

      "pid": 4,

      "src": "resources/images/img6.jpg",

      "thumb": "resources/images/img6.jpg"

    }

  ]

}

layui弹出层_第9张图片

  1. layer.msg

layui弹出层_第10张图片

layui弹出层_第11张图片

  1. layer.tips

layui弹出层_第12张图片

  1. layer.type=0

             //alert

             $("#btn1").click(function() {

                  var x=layer.open({

                      type:0,  //设置类型 默认为0  1 页面层  2ifream层

                      title:"提示",  //标题

                      content:'你好吗?',//内容  type=0为内容

                      skin :'layui-layer-molv',//皮肤

                      /* area: '500px' */

                      area:['500px','300px'],//宽高

                      offset: 'auto',    //offset默认情况下不用设置。但如果你不想垂直水平居中

                      icon:1    //只对type=0的效

                      , btn: ['按钮一', '按钮二', '按钮三']

                      ,yes: function(index, layero){

                          //按钮【按钮一】的回调

                          alert("按钮一");

                          layer.close(index);

                        }

                        ,btn2: function(index, layero){

                          //按钮【按钮二】的回调

                          alert("按钮二")

                          //return false 开启该代码可禁止点击该按钮关闭

                        }

                        ,btn3: function(index, layero){

                          //按钮【按钮三】的回调

                          alert("按钮三")

                          //return false 开启该代码可禁止点击该按钮关闭

                        }

                        ,cancel: function(){

                          //右上角关闭回调

                            alert("cancel")

                          //return false 开启该代码可禁止点击该按钮关闭

                        }

                      ,btnAlign :'c'  //按钮的对齐方式

                      ,closeBtn : 1  //设置关闭按钮的样式  1  默认 

                      ,shade: [0.8, '#FF0000']

                      ,shadeClose:true  //点击遮罩是否关闭弹层

                      ,anim: 4 //设置动画

                      ,maxmin :true //是否显示最大化和最小化的按钮 type=1 type=2有效

                      ,success:function(layero, index){

                          alert(index+"  "+x);

                      }

                  })

                  alert(x);

             });

 

  1. layer.type=1

页面层  把页面上的某一段HTML代码放到弹出层里面

此时的content属性可以使用html代码

                          也可以使用页面元素的选择器

layui弹出层_第13张图片

  1. layer.type=2

type=2时是一个ifream层

此时的content就是一个页面的url

s

layui弹出层_第14张图片

<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2019/10/3
  Time: 14:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    
    layer弹出层
    
    
    
    



    
    
    
    
    
    
    
    <%--//HTML示例--%>
    
图片1 图片2 图片3 图片4 图片5
<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2019/10/3
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    
    layer弹出层
    
    
    
    


    
    
    
    

    

    


 

你可能感兴趣的:(layui)