layui 弹出层监听 判断弹出框的大小

if ($.PublicIsMobile($(window).width()))
{
var layerInitWidth = $("#layui-layer" + ly_dtxm).width();
var layerInitHeight = $("#layui-layer" + ly_dtxm).height();

var docWidth = $(document).width();
var docHeight = $(document).height();
var minWidth = layerInitWidth > docWidth ? docWidth : layerInitWidth;
var minHeight = layerInitHeight > docHeight ? docHeight : layerInitHeight;
parent.layer.style(ly_dtxm, {
//top: 0,
width: minWidth,
height: 20
});
}
else
{
var layerInitWidth = $("#layui-layer" + ly_dtxm).width();
var layerInitHeight = $("#layui-layer" + ly_dtxm).height();
parent.layer.style(ly_dtxm, {
//top: 0,
width: layerInitWidth,
height: layerInitHeight
});
}

posted @ 2018-07-11 10:10  好好學習  阅读(4121)  评论(0编辑  收藏  举报