layer弹出层
使用layer的时候需要在引入layer.js之前引入jquery。
简单的整理一下layer弹出层的几种弹框方式,方便日后使用时的查找:
1.弹出提示层
//弹出一个提示层 $('#test1').on('click', function(){ layer.msg('hello'); });
2.弹出一个页面层
$('#test2').on('click',function(){
layer.open({
type:1,
area:['600px','300px'],
shadowClose:true,
content:'<div style="padding:30px;">弹出的页面层</div>'
});
});
3.弹出一个iframe层
$('#test3').on('click',function(){
layer.open({
type:2,
area:['600px','300px'],
shadowClose:true,
content:"ifram.html"
});
});
4.弹出一个loading层
$('#test4').on('click',function(){
var li = layer.load();
setTimeout(function(){
layer.close(li);
},2000);
});
5.弹出一个tips层
$('#test5').on('click',function(){
layer.tips('hello','#test1');
});
当然,我的代码是没有绑定事件的,需要自己绑定事件。

浙公网安备 33010602011771号