1. 程式人生 > >layer 彈出框與自定義樣式

layer 彈出框與自定義樣式

1 匯入layer.js

2 匯入自定義的layer.css

@charset "utf-8";body .p_window {border: none;
font-size: 12px;
font-family: "Microsoft Yahei", sans-serif;}
    .layui-layer-setwin .layui-layer-close2{
        display: none !important;
}
body .p_window .layui-layer-title{
    color:#fff !important;
background-color: rgb
(0,130,255) !important; font-size: 14px; border-bottom:0; height: 35px; line-height: 35px;}

3 引入全域性樣式

//全域性樣式
layer.config({
    skin: 'p_window'//自定義樣式demo-class
})

4 普通彈出框

layer.open({
type: 1,
title: ' ',
area: ['400px', '130px'],
//area: ['400px'] 高度自適應
shadeClose: false, //點選遮罩關閉content:`<div ></div>`});