实现动态加载的图片页面中纵向居中显示

来源:互联网 发布:a星算法更改父节点 编辑:程序博客网 时间:2024/05/22 14:42
 function showImg(url){            $("#imgDiv").html("<div id='imgBadDiv' style='display: flex;flex-direction: row;justify-content: center;align-content: center'><img id='badImg' src='"+url+"' style='max-height:600px;max-width:800px;' /></div>");            $("#imgBadDiv img").load(function(){                var h = $("#badImg").height();                var top =(document.body.clientHeight-h)/2;                $("#badImg").css("margin-top",top)            });            $("#imgDiv").show();        }
阅读全文
0 0