zoukankan      html  css  js  c++  java
  • layui里面的layer模块弹窗,强制居中的方法!!!

    每次调用layer弹窗做动态展示的时候,只要内容不固定或者需要二次渲染

    比如layui.form.render()进行渲染的时候

    由于弹窗已经出来了,只是content部分的结构改变了宽度或者高度,layer的弹窗就不能居中了

    type:1类型下,可以使用我写的这个强制居中的函数

    //刷新layer弹窗的水平居中位置
    function refreshArea(_formWin){
    	var _formWinObj = $("#layui-layer"+_formWin);
    	  var w = _formWinObj.outerWidth();
    	  var h = _formWinObj.outerHeight();
    	  var l = ($(document).width()-w)/2;
    	  var t = ($(window).height()-h)/2;
    	  _formWinObj.css({
    		  "left":l,
    		  "top":t
    	  });
    }
    
    _formWin 是 layer窗口的index,直接传进去就行
  • 相关阅读:
    树剖
    codeforces round 589
    codeforces round 590
    code craft 20
    Ozon Tech Challenge 2020 (Div.1 + Div.2)
    codeforces round 625
    Crime HDU
    codeforces 594
    codeforces 596
    python操作mysql方法和常见问题
  • 原文地址:https://www.cnblogs.com/programmerVIP/p/12866992.html
Copyright © 2011-2022 走看看