This article mainly introduces the operation method of the layer pop-up plug-in, and analyzes the specific steps and operating techniques of downloading, calling, and setting up the layer pop-up plug-in in detail with examples. Friends in need can refer to the following
The example in this article describes the operation method of the layer pop-up plug-in. Share it with everyone for your reference, the details are as follows:
1. First go to layer.layui.com/ to download the plug-in
2. There are demonstration instructions on the website
3. How to operate
<script src="../js/layer/layer.js"></script> <script> function openadd() { $str=$("#addModal").html();//加载弹窗内容 layer.open({ type: 1, //弹窗类型 title: '显示标题', //显示标题 closeBtn: 1, //是否显示关闭按钮 shadeClose: true, //显示模态窗口 skin: 'layui-layer-rim', //加上边框 area: ['600px', '440px'], //宽高 content: $str //弹窗内容 }); } </script> <p id="addModal"> 要弹窗显示的内容 </p>
Mobile phone pop-up effect
//弹窗后两秒自动关闭 layer.open({ content: '通过style设置你想要的样式', style: 'background-color:#09C1FF; color:#fff; border:none;', time: 2 }); //弹窗后点击关闭 layer.open({ btn: ['关闭'], content:'内容' })
More pop-up effects
Special note: Event needs to be bound by yourself, the following only shows the call code.
//初体验 layer.alert('内容') //第三方扩展皮肤 layer.alert('内容', { icon: 1, skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则,去这里查阅 }) //询问框 layer.confirm('您是如何看待前端开发?', { btn: ['重要','奇葩'] //按钮 }, function(){ layer.msg('的确很重要', {icon: 1}); }, function(){ layer.msg('也可以这样', { time: 20000, //20s后自动关闭 btn: ['明白了', '知道了'] }); }); //提示层 layer.msg('玩命提示中'); //墨绿深蓝风 layer.alert('墨绿风格,点击确认看深蓝', { skin: 'layui-layer-molv' //样式类名 ,closeBtn: 0 }, function(){ layer.alert('偶吧深蓝style', { skin: 'layui-layer-lan' ,closeBtn: 0 ,shift: 4 //动画类型 }); }); //捕获页 layer.open({ type: 1, shade: false, title: false, //不显示标题 content: $('.layer_notice'), //捕获的元素 cancel: function(index){ layer.close(index); this.content.show(); layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6}); } }); //页面层 layer.open({ type: 1, skin: 'layui-layer-rim', //加上边框 area: ['420px', '240px'], //宽高 content: 'html内容' }); //自定页 layer.open({ type: 1, skin: 'layui-layer-demo', //样式类名 closeBtn: 0, //不显示关闭按钮 shift: 2, shadeClose: true, //开启遮罩关闭 content: '内容' }); //tips层 layer.tips('Hi,我是tips', '吸附元素选择器,如#id'); //iframe层 layer.open({ type: 2, title: 'layer mobile页', shadeClose: true, shade: 0.8, area: ['380px', '90%'], content: 'http://layer.layui.com/mobile/' //iframe的url }); //iframe窗 layer.open({ type: 2, title: false, closeBtn: 0, //不显示关闭按钮 shade: [0], area: ['340px', '215px'], offset: 'rb', //右下角弹出 time: 2000, //2秒后自动关闭 shift: 2, content: ['test/guodu.html', 'no'], //iframe的url,no代表不显示滚动条 end: function(){ //此处用于演示 layer.open({ type: 2, title: '很多时候,我们想最大化看,比如像这个页面。', shadeClose: true, shade: false, maxmin: true, //开启最大化最小化按钮 area: ['893px', '600px'], content: 'http://fly.layui.com/' }); } }); //加载层 var index = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2 //loading层 var index = layer.load(1, { shade: [0.1,'#fff'] //0.1透明度的白色背景 }); //小tips layer.tips('我是另外一个tips,只不过我长得跟之前那位稍有些不一样。', '吸附元素选择器', { tips: [1, '#3595CC'], time: 4000 }); //prompt层 layer.prompt({ title: '输入任何口令,并确认', formType: 1 //prompt风格,支持0-2 }, function(pass){ layer.prompt({title: '随便写点啥,并确认', formType: 2}, function(text){ layer.msg('演示完毕!您的口令:'+ pass +' 您最后写下了:'+ text); }); }); //tab层 layer.tab({ area: ['600px', '300px'], tab: [{ title: 'TAB1', content: '内容1' }, { title: 'TAB2', content: '内容2' }, { title: 'TAB3', content: '内容3' }] }); //相册层 $.getJSON('test/photos.json?v='+new Date, function(json){ layer.photos({ photos: json //格式见API文档手册页 ,shift: 5 //0-6的选择,指定弹出图片动画类型,默认随机 }); });
【Related recommendations】
1. Javacript free video tutorial
2. JS development using Baidu map code organization
3. Use node.js to analyze the url output file and send it to the client
4. Detailed explanation of the example of using JavaScript to convert Chinese characters to Pinyin
5. Share 15 commonly used js regular expressions
The above is the detailed content of Tutorial on using the layer pop-up plug-in. For more information, please follow other related articles on the PHP Chinese website!

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Linux new version
SublimeText3 Linux latest version