2.0 KiB
Executable File
2.0 KiB
Executable File
从页面四个边缘弹出(抽屉效果):
从上往下
从右往左
从下往上
从左往右
<script>
layui.use(function(){
var layer = layui.layer;
var util = layui.util;
var $ = layui.$;
// 事件
util.on('lay-on', {
'test-offset-t': function(){
layer.open({
type: 1,
offset: 't',
anim: 'slideDown', // 从上往下
area: ['100%', '160px'],
shade: 0.1,
shadeClose: true,
id: 'ID-demo-layer-direction-t',
content: '任意 HTML 内容
'
});
},
'test-offset-r': function(){
layer.open({
type: 1,
offset: 'r',
anim: 'slideLeft', // 从右往左
area: ['320px', '100%'],
shade: 0.1,
shadeClose: true,
id: 'ID-demo-layer-direction-r',
content: '任意 HTML 内容
'
});
},
'test-offset-b': function(){
layer.open({
type: 1,
offset: 'b',
anim: 'slideUp', // 从下往上
area: ['100%', '160px'],
shade: 0.1,
shadeClose: true,
id: 'ID-demo-layer-direction-b',
content: '任意 HTML 内容
'
});
},
'test-offset-l': function(){
layer.open({
type: 1,
offset: 'l',
anim: 'slideRight', // 从左往右
area: ['320px', '100%'],
shade: 0.1,
shadeClose: true,
id: 'ID-demo-layer-direction-l',
content: '任意 HTML 内容
'
});
}
});
});
</script>