search
HomeWeb Front-endLayui TutorialHow to customize the width and height of the layer in layui?

The layer module in layui can use the area attribute to set the width and height. By default, the layer is adaptive in both width and height, but when you need to customize the width and height, you can use the "area:['width','height']" statement to set it, for example "area:['500px' ,'300px']".

How to customize the width and height of the layer in layui?

By default, the layer is adaptive in both width and height

But sometimes you need to customize the width and height separately. The code is as follows:

var looptran = layer.msg(loopTranInfo, {
    time: 10000, //10s后自动关闭
    area:['300px', '200px'] ,
     /* area: '400px',*/
    btn: ['确定']
});

area:['300px', '200px'] You can customize the height and width

As mentioned on the Internet, define layer.msg first, and then use layer.style Limiting width or height is invalid! The invalid code is as follows:

var looptran = layer.msg(loopTranInfo, {
    time: 10000, //10s后自动关闭
    area:['300px', '200px'] ,
     /* area: '400px',*/
    btn: ['确定']
}); 
layer.style(looptran, {
    width: '400px',
    height:'200px'});

Official website description screenshot:
How to customize the width and height of the layer in layui?

For more programming-related knowledge, please visit: Programming Course! !

The above is the detailed content of How to customize the width and height of the layer in layui?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)