推荐几款好用的模态框附带教程
生活随笔
收集整理的这篇文章主要介绍了
推荐几款好用的模态框附带教程
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
一、layer弹出组件
下载地址:http://www.chtml.cn/topic/show/25
如何安装:
1.下载完毕后把layer文件夹拿出放到你的工程目录下thinkphp请放在指定的公共目录下,以便前后台使用。
2.layer的弹出框引用文件
3.layer框架的使用
如图的html代码:
layer的js控制代码:
//关于 $('#about').on('click', function(){layer.alert(layer.v + ' - 贤心出品 sentsin.com'); });$("#tanchu").click(function(){//墨绿深蓝风layer.alert('墨绿风格,点击确认看深蓝', {skin: 'layui-layer-molv' //样式类名,closeBtn: 0}, function(){layer.alert('偶吧深蓝style', {skin: 'layui-layer-lan',closeBtn: 0,shift: 4 //动画类型});}); })$("#xunwen").click(function(){//询问框layer.confirm('您是如何看待前端开发?', {btn: ['重要','奇葩'] //按钮}, function(){layer.msg('的确很重要', {icon: 1});}, function(){layer.msg('也可以这样', {time: 20000, //20s后自动关闭btn: ['明白了', '知道了']});}); })$("#tishi").click(function(){//提示层layer.msg('玩命提示中'); })$("#buhuo").click(function(){//捕获页layer.open({type: 1,shade: false,title: false, //不显示标题content: $('.layer_notice'), //捕获的元素cancel: function(index){layer.close(index);this.content.hide();layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', {time: 5000, icon:6});}}); })$("#ymc").click(function(){//页面层layer.open({type: 1,skin: 'layui-layer-rim', //加上边框area: ['420px', '240px'], //宽高content: 'html内容'}); })$("#zdyy").click(function(){//页面层layer.open({type: 1,skin: 'layui-layer-rim', //加上边框area: ['420px', '240px'], //宽高content: 'html内容'}); })$("#jzc").click(function(){var index = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2 });$("#load").click(function(){//loading层var index = layer.load(1, {shade: [0.1,'#fff'] //0.1透明度的白色背景}); })二、bootbox.js弹出框组件
下载地址:http://www.chtml.cn/topic/show/35
引入js文件代码:
html页面模态框控制代码:
<a href="javascript:;" val="" class="del"></a>js控制代码
$(".del").click(function(){var url = $(this).attr('val');bootbox.confirm({title: "系统提示",message: "是否要该文章?", callback:function(result){if(result){}},buttons: {"cancel" : {"label" : "取消"},"confirm" : {"label" : "确定","className" : "btn-danger"}}});});三、bootstrap模态框
下载地址:http://v3.bootcss.com/javascript/
版本:bootstrap 3
引入文件:
html代码:
演示模态框
大小提示模态框
<!-- Large modal --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button><div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"><div class="modal-dialog modal-lg"><div class="modal-content">...</div></div> </div><!-- Small modal --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button><div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"><div class="modal-dialog modal-sm"><div class="modal-content">...</div></div> </div>总结
以上是生活随笔为你收集整理的推荐几款好用的模态框附带教程的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: linux svn 服务 关闭,Linu
- 下一篇: 点到曲线的距离_如何从“圆锥”曲线到圆锥