700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > layui iframe弹出层高度自适应 并垂直居中

layui iframe弹出层高度自适应 并垂直居中

时间:2019-11-04 14:51:08

相关推荐

layui iframe弹出层高度自适应 并垂直居中

1、高度自适应:

代码:

success: function(layero, index) {

layer.iframeAuto(index);

},

2、垂直居中

进入layer.js,增加几行代码。具体如图:

代码:

var bodyHH = document.documentElement.clientHeight;

if(heg + titHeight + btnHeight > $(window).height()){

layero.css({height:$(window).height(),

top:(bodyHH-$(window).height())*0.5});

layero.find('iframe').css({height:$(window).height()-titHeight-btnHeight,

top:(bodyHH-$(window).height())*0.5});

}else{

layero.css({height: heg + titHeight + btnHeight,

top:(bodyHH-(heg + titHeight + btnHeight))*0.5});

layero.find('iframe').css({height: heg,

top:(bodyHH-(heg + titHeight + btnHeight))*0.5});

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。