html/css/js-layer弹出层的初次使用
学习前端有时很多时候要用到弹出层,原生的js写有些麻烦,而且不美观,基于jQuery的弹出层组件layer应运而生,近些年来备受青睐。官网上有使用教程,但当初用的时候还是糊里糊涂,今天来记录一下layer组件的步骤
1step:
新建一个html文件,并引入下载好的jQuery和layer.js。
2step:
码字
<!doctype html>
<html>
<meta charset="utf-8">
<head>
<title></title>
<style> </style>
<!--导入外部js脚本-->
<script src="../jquery-3.3.1.js"></script> <script src="../layer例子/layer-v3.1.1/layer/layer.js"></script>
</head>
<body>
<div style="width:1000px;height:1000px;margin:auto;border:1px solid #999;">
<button style="width:70px;height:40px;float:left;font-size:13px;line-height:20px;text-align:center;" onClick="openRegister()">点击我</button>
</div> <!--弹出层界面-->
<div style="display:none;padding:30px;" id="registerlayer">
<span style="color:#999;font-size:25px;float:left">注册</span>
<span style="color:#999;font-size:13px;float:right;margin:10px 0 0 0;" class="hover3" onClick="goLogin()">快速登录</span>
<div style="width:298px;height:138px;float:left;border:1px solid #ccc;margin:30px 0 0 0;">
<input style="width:294px;height:42px;border:1px solid #fff;border-bottom:1px solid #ccc;" type="text" placeholder="注册新用户">
<input style="width:294px;height:42px;border:1px solid #fff;border-bottom:1px solid #ccc;" type="password" placeholder="请设置密码">
<input style="width:294px;height:42px;border:1px solid #fff;" type="password" placeholder="请确认密码">
</div>
<input style="margin:20px 0 0 0;float:left;" type="checkbox" id="registerAgree" checked="checked" >
<span style="margin:18px 0 0 0 ;float:left;font-size:12px;color:#999;"> 我已阅读并接受鹦鹉网</span>
<span style="margin:18px 0 0 0 ;float:left;font-size:12px;color:#069;" class="hover4">《服务协议》</span>
<span style="margin:18px 0 0 0 ;float:left;font-size:12px;color:#999;">和</span>
<span style="margin:18px 0 0 0 ;float:left;font-size:12px;color:#069;" class="hover4">《账户协议》</span>
<div style="width:298px;height:40px;float:left;background:#6FAC22;margin:30px 0 0 0;text-align:center;line-height:40px;font-size:16px;" id="register" >注 册</div>
</div> <script>
//注册弹出层
function openRegister(){
layer.open({
type: 1,
title: false,
area : ['360px' , '400px'],
closeBtn: 0,
shadeClose: true,
skin: 'yourclass',
content: $('#registerlayer'),
});
} $(document).ready(function(){
$("#registerAgree").click(function(){ var check=document.getElementById("registerAgree"); if(check.checked!=true){
$("#register").css("background","#ccc");
}
else {
$("#register").css("background","#6FAC22");
}
});
});
</script> </body>
html/css/js-layer弹出层的初次使用的更多相关文章
- layer弹出层
最近因为项目要求做了一个layer弹出层demo,先看效果图 好了,现在开始上代码 index.jsp <%@ page language="java" import=&qu ...
- js插件---弹出层sweetalert2(总结)
js插件---弹出层sweetalert2(总结) 一.总结 一句话总结: sweetalert2的效果非常好,效果比较Q萌,移动端适配也比较好,感觉比layer.js效果好点 1.SweetAler ...
- layer弹出层右上角的关闭按钮怎么没有显示
问题描述:layer弹出层右上角的关闭按钮怎么没有显示,但鼠标移上去又可以点击 解决方式: 这是因为样式中需要一个图标,你的项目中缺少.解决如下:1.下载图标:http://www-x-zi-han- ...
- js简单弹出层、遮罩层
<html> <head> <title>js简单弹出层</title> <style> /*阴影边框效果*/ .box-shadow-1 ...
- layer弹出层设置相对父级元素定位
layer弹出层默认是相对body固定定位的,可是项目中一般需要相对某个盒子相对定位,下面是个加载弹层例子: var loadIndex = layer.open({ type: 3, //3 表示加 ...
- layer弹出层不居中解决方案
layer弹出层不居中解决方案 代码头中加入以下代码即可 <!doctype html>
- layer弹出层不居中解决方案,layer提示不屏幕居中解决方法,layer弹窗不居中解决方案
layer弹出层不居中解决方案,layer提示不屏幕居中解决方法,layer弹窗不居中解决方案 >>>>>>>>>>>>> ...
- Layer弹出层销毁问题
Layer弹出层销毁问题 最近开发时有个问题记录一下 点击按钮显示相应的图表信息,当时自己点感觉没问题,谁知到测试手里多次点击就会有后续打开的窗口无法渲染问题,看了半天才发现是调用layer.clos ...
- layer 弹出层 回调函数调用 弹出层页面 函数
1.项目中用到layer 弹出层,定义一个公用的窗口,问题来了窗口弹出来了,如何保存页面上的数据呢?疯狂百度之后,有了结果,赶紧记下. 2.自己定义的公共页面方法: layuiWindow: func ...
- layer 弹出层 不居中
layer弹出层不居中解决方案 代码头中加入以下代码即可 <!doctype html>
随机推荐
- Win10系列:C#应用控件基础8
ToggleSwitch控件 在应用程序中ToggleSwitch控件可以模拟一个允许用户在启用和禁用两种状态之间进行切换的物理开关,ToggleSwitch控件的功能与我们在日常生活中所使用的电源开 ...
- day18_python_1124
01 鸡汤 荷花定律 山竹定律 金蝉定律 荷花定律: 明天比今天要生长多一倍,池塘三十天生长满,第29天是一半. 山竹定律: 竹子在生长时,前三年只出地表3厘米,从第四年开始,以每天30cm的速度开始 ...
- 微服务-开发框架之springboot by 大雄daysn
目录 一.关于springboot 二.springboot的实践 2.1发布一个rest的api 2.2端点 2.3健康检查 2.4远程监控 一.关于springboot 由来:spring1.0- ...
- docker命令脚本
第一版: 1 #!/bin/bash #this is input docker continer shell! #this is -- # v1.1.2 read -p "请输入要执行do ...
- 经典的Foo和getName
搜了下经典的Foo和getName的题目,看了几个解释,懒得看,自己解一下,作为笔记. function Foo(){ getName = function(){ console.log(1); }; ...
- fastTime从后台传过来显示格式的处理
1.可以在控制台用syso查看 QuestionFeedbackView qfv = on_LineManageService.getBringupHead(projectNo);//qfv是一个内含 ...
- copy GC 和 mark & compaction GC的算法异同
先标记 然后 copy GC是,对所有child,判断, 如果child没有被访问过,那么拷贝到新地址,child的forwording指向新地址,child标记为已访问,把自己对child的引用改为 ...
- ipone 5s上,字体rem遇到的问题
webapp中,12px的字体,利用rem实现自适应布局, 发现只有在ipone 5s中字体超大, 这两个class元素中字体一样大小,发现上面元素字体在ipone 5s中很大, 后来验证问题在哪里, ...
- 马凯军201771010116《面向对象程序设计(java)》第六周学习总结
第一部分:理论知识学习部分 枚举是一种特殊的数据类型,之所以特殊是因为它既是一种类(class)类型却又比类型多了些特殊的约束,但是这些约束的存在也造就了枚举类型的简洁,安全性以及便捷性.创建枚举类型 ...
- spring集成jedis简单实例
jedis是redis的java客户端,spring将redis连接池作为一个bean配置. redis连接池分为两种,一种是“redis.clients.jedis.ShardedJedisPool ...